PK œqhYî¶J‚ßF ßF ) nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/
Dir : /home/trave494/demo2024feb.kerihosting.com/wp-content/themes/genesis/lib/shortcodes/ |
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 IP: 209.182.202.254 |
Dir : /home/trave494/demo2024feb.kerihosting.com/wp-content/themes/genesis/lib/shortcodes/post.php |
<?php /** * Genesis Framework. * * WARNING: This file is part of the core Genesis Framework. DO NOT edit this file under any circumstances. * Please do all modifications in the form of a child theme. * * @package Genesis\Shortcodes * @author StudioPress * @license GPL-2.0-or-later * @link https://my.studiopress.com/themes/genesis/ */ add_shortcode( 'post_date', 'genesis_post_date_shortcode' ); /** * Produces the date of post publication. * * Supported shortcode attributes are: * after (output after link, default is empty string), * before (output before link, default is empty string), * format (date format, default is value in date_format option field), * label (text following 'before' output, but before date). * * Output passes through `genesis_post_date_shortcode` filter before returning. * * @since 1.1.0 * * @param array|string $atts Shortcode attributes. Empty string if no attributes. * @return string Output for `post_date` shortcode. */ function genesis_post_date_shortcode( $atts ) { $defaults = array( 'after' => '', 'before' => '', 'format' => get_option( 'date_format' ), 'label' => '', 'relative_depth' => 2, ); $atts = shortcode_atts( $defaults, $atts, 'post_date' ); if ( 'relative' === $atts['format'] ) { $display = genesis_human_time_diff( get_the_time( 'U' ), current_time( 'timestamp' ), $atts['relative_depth'] ); $display .= ' ' . __( 'ago', 'genesis' ); } else { $display = get_the_time( $atts['format'] ); } if ( genesis_html5() ) { $output = sprintf( '<time %s>', genesis_attr( 'entry-time' ) ) . $atts['before'] . $atts['label'] . $display . $atts['after'] . '</time>'; } else { $output = sprintf( '<span class="date published time" title="%5$s">%1$s%3$s%4$s%2$s</span> ', $atts['before'], $atts['after'], $atts['label'], $display, get_the_time( 'c' ) ); } return apply_filters( 'genesis_post_date_shortcode', $output, $atts ); } add_shortcode( 'post_time', 'genesis_post_time_shortcode' ); /** * Produces the time of post publication. * * Supported shortcode attributes are: * after (output after link, default is empty string), * before (output before link, default is empty string), * format (date format, default is value in date_format option field), * label (text following 'before' output, but before date). * * Output passes through `genesis_post_time_shortcode` filter before returning. * * @since 1.1.0 * * @param array|string $atts Shortcode attributes. Empty string if no attributes. * @return string Output for `post_time` shortcode`. */ function genesis_post_time_shortcode( $atts ) { $defaults = array( 'after' => '', 'before' => '', 'format' => get_option( 'time_format' ), 'label' => '', ); $atts = shortcode_atts( $defaults, $atts, 'post_time' ); if ( genesis_html5() ) { $output = sprintf( '<time %s>', genesis_attr( 'entry-time' ) ) . $atts['before'] . $atts['label'] . get_the_time( $atts['format'] ) . $atts['after'] . '</time>'; } else { $output = sprintf( '<span class="date published time" title="%5$s">%1$s%3$s%4$s%2$s</span> ', $atts['before'], $atts['after'], $atts['label'], get_the_time( $atts['format'] ), get_the_time( 'c' ) ); } return apply_filters( 'genesis_post_time_shortcode', $output, $atts ); } add_shortcode( 'post_modified_date', 'genesis_post_modified_date_shortcode' ); /** * Produce the post last modified date. * * Supported shortcode attributes are: * * after (output after date, default is empty string), * * before (output before date, default is empty string), * * format (date format, default is value in date_format option field), * * label (text following 'before' output, but before date). * * Output passes through `genesis_post_modified_date_shortcode` filter before returning. * * @since 2.1.0 * * @param array|string $atts Shortcode attributes. Empty string if no attributes. * @return string Output for `post_modified_date` shortcode. */ function genesis_post_modified_date_shortcode( $atts ) { $defaults = array( 'after' => '', 'before' => '', 'format' => get_option( 'date_format' ), 'label' => '', 'relative_depth' => 2, ); $atts = shortcode_atts( $defaults, $atts, 'post_modified_date' ); if ( 'relative' === $atts['format'] ) { $display = genesis_human_time_diff( get_the_modified_time( 'U' ), current_time( 'timestamp' ), $atts['relative_depth'] ); $display .= ' ' . __( 'ago', 'genesis' ); } else { $display = get_the_modified_time( $atts['format'] ); } if ( genesis_html5() ) { $output = sprintf( '<time %s>', genesis_attr( 'entry-modified-time' ) ) . $atts['before'] . $atts['label'] . $display . $atts['after'] . '</time>'; } else { $output = sprintf( '<span class="date updated time" title="%5$s">%1$s%3$s%4$s%2$s</span> ', $atts['before'], $atts['after'], $atts['label'], $display, get_the_modified_time( 'c' ) ); } /** * Change the output of the post_modified_date shortcode. * * @since 2.1.0 * * @param string $output Markup containing post last modification date. * @param array $atts { * Shortcode attributes after merging with default values. * * @type string $after Output after date. * @type string $before Output before date. * @type string $format Date format, could be 'relative'. * @type string $label Text following 'before' output, but before date. * } */ return apply_filters( 'genesis_post_modified_date_shortcode', $output, $atts ); } add_shortcode( 'post_modified_time', 'genesis_post_modified_time_shortcode' ); /** * Produce the post last modified time. * * Supported shortcode attributes are: * * after (output after time, default is empty string), * * before (output before time, default is empty string), * * format (date format, default is value in date_format option field), * * label (text following 'before' output, but before time). * * Output passes through `genesis_post_modified_time_shortcode` filter before returning. * * @since 2.1.0 * * @param array|string $atts Shortcode attributes. Empty string if no attributes. * @return string Output for `post_modified_time` shortcode. */ function genesis_post_modified_time_shortcode( $atts ) { $defaults = array( 'after' => '', 'before' => '', 'format' => get_option( 'time_format' ), 'label' => '', ); $atts = shortcode_atts( $defaults, $atts, 'post_modified_time' ); if ( genesis_html5() ) { $output = sprintf( '<time %s>', genesis_attr( 'entry-modified-time' ) ) . $atts['before'] . $atts['label'] . get_the_modified_time( $atts['format'] ) . $atts['after'] . '</time>'; } else { $output = sprintf( '<span class="date updated time" title="%5$s">%1$s%3$s%4$s%2$s</span> ', $atts['before'], $atts['after'], $atts['label'], get_the_modified_time( $atts['format'] ), get_the_modified_time( 'c' ) ); } /** * Change the output of the post_modified_time shortcode. * * @since 2.1.0 * * @param string $output Markup containing post last modification time. * @param array $atts { * Shortcode attributes after merging with default values. * * @type string $after Output after time. * @type string $before Output before time. * @type string $format Date format, could be 'relative'. * @type string $label Text following 'before' output, but before time. * } */ return apply_filters( 'genesis_post_modified_time_shortcode', $output, $atts ); } add_shortcode( 'post_author', 'genesis_post_author_shortcode' ); /** * Produces the author of the post (unlinked display name). * * Supported shortcode attributes are: * after (output after link, default is empty string), * before (output before link, default is empty string). * * Output passes through `genesis_post_author_shortcode` filter before returning. * * @since 1.1.0 * * @param array|string $atts Shortcode attributes. Empty string if no attributes. * @return string Return empty string if post type does not support `author`, or has no author assigned. * Otherwise, output for `post_author` shortcode. */ function genesis_post_author_shortcode( $atts ) { if ( ! post_type_supports( get_post_type(), 'author' ) ) { return ''; } $author = get_the_author(); if ( ! $author ) { return ''; } $defaults = array( 'after' => '', 'before' => '', ); $atts = shortcode_atts( $defaults, $atts, 'post_author' ); if ( genesis_html5() ) { $output = sprintf( '<span %s>', genesis_attr( 'entry-author' ) ); $output .= $atts['before']; $output .= sprintf( '<span %s>', genesis_attr( 'entry-author-name' ) ) . esc_html( $author ) . '</span>'; $output .= $atts['after']; $output .= '</span>'; } else { $output = sprintf( '<span class="author vcard">%2$s<span class="fn">%1$s</span>%3$s</span>', esc_html( $author ), $atts['before'], $atts['after'] ); } return apply_filters( 'genesis_post_author_shortcode', $output, $atts ); } add_shortcode( 'post_author_link', 'genesis_post_author_link_shortcode' ); /** * Produces the author of the post (link to author URL). * * Supported shortcode attributes are: * after (output after link, default is empty string), * before (output before link, default is empty string). * * Output passes through `genesis_post_author_link_shortcode` filter before returning. * * @since 1.1.0 * * @param array|string $atts Shortcode attributes. Empty string if no attributes. * @return string Return empty string if post type does not support `author` or post has no author assigned. * Return `genesis_post_author_shortcode()` if author has no URL. * Otherwise, output for `post_author_link` shortcode. */ function genesis_post_author_link_shortcode( $atts ) { if ( ! post_type_supports( get_post_type(), 'author' ) ) { return ''; } $url = get_the_author_meta( 'url' ); // If no URL, use post author shortcode function. if ( ! $url ) { return genesis_post_author_shortcode( $atts ); } $author = get_the_author(); if ( ! $author ) { return ''; } $defaults = array( 'after' => '', 'before' => '', ); $atts = shortcode_atts( $defaults, $atts, 'post_author_link' ); if ( genesis_html5() ) { $output = sprintf( '<span %s>', genesis_attr( 'entry-author' ) ); $output .= $atts['before']; $output .= sprintf( '<a href="%s" %s>', $url, genesis_attr( 'entry-author-link' ) ); $output .= sprintf( '<span %s>', genesis_attr( 'entry-author-name' ) ); $output .= esc_html( $author ); $output .= '</span></a>' . $atts['after'] . '</span>'; } else { $link = '<a href="' . esc_url( $url ) . '" rel="author external">' . esc_html( $author ) . '</a>'; $output = sprintf( '<span class="author vcard">%2$s<span class="fn">%1$s</span>%3$s</span>', $link, $atts['before'], $atts['after'] ); } return apply_filters( 'genesis_post_author_link_shortcode', $output, $atts ); } add_shortcode( 'post_author_posts_link', 'genesis_post_author_posts_link_shortcode' ); /** * Produces the author of the post (link to author archive). * * Supported shortcode attributes are: * after (output after link, default is empty string), * before (output before link, default is empty string). * * Output passes through `genesis_post_author_posts_link_shortcode` filter before returning. * * @since 1.1.0 * * @param array|string $atts Shortcode attributes. Empty string if no attributes. * @return string Return empty string if post type does not support `author` or post has no author assigned. * Otherwise, output for `post_author_posts_link` shortcode. */ function genesis_post_author_posts_link_shortcode( $atts ) { if ( ! post_type_supports( get_post_type(), 'author' ) ) { return ''; } $author = get_the_author(); if ( ! $author ) { return ''; } $defaults = array( 'after' => '', 'before' => '', ); $atts = shortcode_atts( $defaults, $atts, 'post_author_posts_link' ); $url = get_author_posts_url( get_the_author_meta( 'ID' ) ); if ( genesis_html5() ) { $output = sprintf( '<span %s>', genesis_attr( 'entry-author' ) ); $output .= $atts['before']; $output .= sprintf( '<a href="%s" %s>', $url, genesis_attr( 'entry-author-link' ) ); $output .= sprintf( '<span %s>', genesis_attr( 'entry-author-name' ) ); $output .= esc_html( $author ); $output .= '</span></a>' . $atts['after'] . '</span>'; } else { $link = sprintf( '<a href="%s" rel="author">%s</a>', esc_url( $url ), esc_html( $author ) ); $output = sprintf( '<span class="author vcard">%2$s<span class="fn">%1$s</span>%3$s</span>', $link, $atts['before'], $atts['after'] ); } return apply_filters( 'genesis_post_author_posts_link_shortcode', $output, $atts ); } add_shortcode( 'post_comments', 'genesis_post_comments_shortcode' ); /** * Produces the link to the current post comments. * * Supported shortcode attributes are: * after (output after link, default is empty string), * before (output before link, default is empty string), * hide_if_off (hide link if comments are off, default is 'enabled' (true)), * more (text when there is more than 1 comment, use % character as placeholder * for actual number, default is '% Comments') * one (text when there is exactly one comment, default is '1 Comment'), * zero (text when there are no comments, default is 'Leave a Comment'). * * Output passes through `genesis_post_comments_shortcode` filter before returning. * * @since 1.1.0 * * @param array|string $atts Shortcode attributes. Empty string if no attributes. * @return string Return empty string if post does not support `comments`, or `hide_if_off` is enabled and * comments are closed or disabled in Genesis theme settings. * Otherwise, output for `post_comments` shortcode. */ function genesis_post_comments_shortcode( $atts ) { if ( ! post_type_supports( get_post_type(), 'comments' ) ) { return ''; } $defaults = array( 'after' => '', 'before' => '', 'hide_if_off' => 'enabled', 'more' => __( '% Comments', 'genesis' ), 'one' => __( '1 Comment', 'genesis' ), 'zero' => __( 'Leave a Comment', 'genesis' ), ); $atts = shortcode_atts( $defaults, $atts, 'post_comments' ); if ( 'enabled' === $atts['hide_if_off'] && ( ! genesis_get_option( 'comments_posts' ) || ! comments_open() ) ) { return ''; } // Darn you, WordPress! ob_start(); comments_number( $atts['zero'], $atts['one'], $atts['more'] ); $comments = ob_get_clean(); $comments = sprintf( '<a href="%s">%s</a>', get_comments_link(), $comments ); $output = genesis_markup( array( 'open' => '<span class="entry-comments-link">', 'close' => '</span>', 'content' => $atts['before'] . $comments . $atts['after'], 'context' => 'comments-shortcode', 'echo' => false, ) ); return apply_filters( 'genesis_post_comments_shortcode', $output, $atts ); } add_shortcode( 'post_tags', 'genesis_post_tags_shortcode' ); /** * Produces the tag links list. * * Supported shortcode attributes are: * after (output after link, default is empty string), * before (output before link, default is 'Tagged With: '), * sep (separator string between tags, default is ', '). * * Output passes through `genesis_post_tags_shortcode` filter before returning. * * @since 1.1.0 * * @param array|string $atts Shortcode attributes. Empty string if no attributes. * @return string Return empty string if the `post_tag` taxonomy is not associated with the current post type * or if the post has no tags. Otherwise, output for `post_tags` shortcode. */ function genesis_post_tags_shortcode( $atts ) { if ( ! is_object_in_taxonomy( get_post_type(), 'post_tag' ) ) { return ''; } $defaults = array( 'after' => '', 'before' => __( 'Tagged With: ', 'genesis' ), 'sep' => ', ', ); $atts = shortcode_atts( $defaults, $atts, 'post_tags' ); $tags = get_the_tag_list( $atts['before'], trim( $atts['sep'] ) . ' ', $atts['after'] ); // Do nothing if no tags. if ( ! $tags ) { return ''; } if ( genesis_html5() ) { $output = sprintf( '<span %s>', genesis_attr( 'entry-tags' ) ) . $tags . '</span>'; } else { $output = '<span class="tags">' . $tags . '</span>'; } return apply_filters( 'genesis_post_tags_shortcode', $output, $atts ); } add_shortcode( 'post_categories', 'genesis_post_categories_shortcode' ); /** * Produces the category links list. * * Supported shortcode attributes are: * after (output after link, default is empty string), * before (output before link, default is 'Tagged With: '), * sep (separator string between tags, default is ', '). * * Output passes through 'genesis_post_categories_shortcode' filter before returning. * * @since 1.1.0 * * @param array|string $atts Shortcode attributes. Empty string if no attributes. * @return string Return empty string if the `category` taxonomy is not associated with the current post type * or if the post has no categories. Otherwise, output for `post_categories` shortcode. */ function genesis_post_categories_shortcode( $atts ) { if ( ! is_object_in_taxonomy( get_post_type(), 'category' ) ) { return ''; } $defaults = array( 'sep' => ', ', 'before' => __( 'Filed Under: ', 'genesis' ), 'after' => '', ); $atts = shortcode_atts( $defaults, $atts, 'post_categories' ); $cats = get_the_category_list( trim( $atts['sep'] ) . ' ' ); // Do nothing if there are no categories. if ( ! $cats ) { return ''; } if ( genesis_html5() ) { $output = sprintf( '<span %s>', genesis_attr( 'entry-categories' ) ) . $atts['before'] . $cats . $atts['after'] . '</span>'; } else { $output = '<span class="categories">' . $atts['before'] . $cats . $atts['after'] . '</span>'; } return apply_filters( 'genesis_post_categories_shortcode', $output, $atts ); } add_shortcode( 'post_terms', 'genesis_post_terms_shortcode' ); /** * Produces the linked post taxonomy terms list. * * Supported shortcode attributes are: * after (output after link, default is empty string), * before (output before link, default is 'Filed Under: '), * sep (separator string between tags, default is ', '), * taxonomy (name of the taxonomy, default is 'category'). * * Output passes through `genesis_post_terms_shortcode` filter before returning. * * @since 1.6.0 * * @param array|string $atts Shortcode attributes. Empty string if no attributes. * @return string Output for `post_terms` shortcode, or empty string on failure to retrieve terms. */ function genesis_post_terms_shortcode( $atts ) { $defaults = array( 'after' => '', 'before' => __( 'Filed Under: ', 'genesis' ), 'sep' => ', ', 'taxonomy' => 'category', ); /** * Post terms shortcode defaults. * * Allows the default args in the post terms shortcode function to be filtered. * * @since 2.0.0 * * @param array $defaults The default args array. */ $defaults = apply_filters( 'genesis_post_terms_shortcode_defaults', $defaults ); $atts = shortcode_atts( $defaults, $atts, 'post_terms' ); $terms = get_the_term_list( get_the_ID(), $atts['taxonomy'], $atts['before'], trim( $atts['sep'] ) . ' ', $atts['after'] ); if ( is_wp_error( $terms ) ) { return ''; } if ( empty( $terms ) ) { return ''; } if ( genesis_html5() ) { $output = sprintf( '<span %s>', genesis_attr( 'entry-terms' ) ) . $terms . '</span>'; } else { $output = '<span class="terms">' . $terms . '</span>'; } return apply_filters( 'genesis_post_terms_shortcode', $output, $terms, $atts ); } add_shortcode( 'post_edit', 'genesis_post_edit_shortcode' ); /** * Produces the edit post link for logged in users. * * Supported shortcode attributes are: * after (output after link, default is empty string), * before (output before link, default is 'Tagged With: '), * link (link text, default is '(Edit)'). * * Output passes through `genesis_post_edit_shortcode` filter before returning. * * @since 1.1.0 * * @param array|string $atts Shortcode attributes. Empty string if no attributes. * @return string Output for `post_edit` shortcode, or empty string if `genesis_edit_post_link` filter returns `false`. */ function genesis_post_edit_shortcode( $atts ) { if ( ! apply_filters( 'genesis_edit_post_link', true ) ) { return ''; } $defaults = array( 'after' => '', 'before' => '', 'link' => __( '(Edit)', 'genesis' ), ); $atts = shortcode_atts( $defaults, $atts, 'post_edit' ); // Darn you, WordPress! ob_start(); edit_post_link( $atts['link'], $atts['before'], $atts['after'] ); $edit = ob_get_clean(); $output = $edit; return apply_filters( 'genesis_post_edit_shortcode', $output, $atts ); } add_shortcode( 'adsense_hint', 'genesis_entry_adsense_hint' ); /** * Produces adsense hint markup. * * Request a Google Adsense advert wherever placed. * * @since 2.6.0 * * @param array|string $atts Shortcode attributes. Empty string if no attributes. * @return string Output for `genesis_adsense_hint` shortcode, or empty string if no adsense publisher ID is found. */ function genesis_entry_adsense_hint( $atts ) { if ( ! genesis_get_option( 'adsense_id' ) ) { return ''; } $defaults = array( 'id' => '', ); $atts = shortcode_atts( $defaults, $atts ); // Generate ID if none provided. if ( ! $atts['id'] ) { static $i = 1; $atts['id'] = sprintf( 'ad-%d-%d', get_the_ID(), $i ); $i++; } $output = '<!-- adsense -->'; $output .= sprintf( '<div><ins id="%s" style="display: none;" class="adsbygoogle-placeholder"></ins></div>', esc_attr( $atts['id'] ) ); return $output; }