is_comment_feed example


function get_comment_text( $comment_id = 0, $args = array() ) {
    $comment = get_comment( $comment_id );

    $comment_text = $comment->comment_content;

    if ( is_comment_feed() && $comment->comment_parent ) {
        $parent = get_comment( $comment->comment_parent );
        if ( $parent ) {
            $parent_link = esc_url( get_comment_link( $parent ) );
            $name        = get_comment_author( $parent );

            $comment_text = sprintf(
                /* translators: %s: Comment link. */
                ent2ncr( __( 'In reply to %s.' ) ),
                '<a href="' . $parent_link . '">' . $name . '</a>'
            ) . "\n\n" . $comment_text;
        }
    }

function is_comment_feed() {
    global $wp_query;

    if ( ! isset( $wp_query ) ) {
        _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
        return false;
    }

    return $wp_query->is_comment_feed();
}

/** * Determines whether the query is for the front page of the site. * * This is for what is displayed at your site's main URL. * * Depends on the site's "Front page displays" Reading Settings 'show_on_front' and 'page_on_front'. * * If you set a static page for the front page of your site, this function will return * true when viewing that page. * * Otherwise the same as @see is_home() * * For more information on this and similar theme functions, check out * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ * Conditional Tags} article in the Theme Developer Handbook. * * @since 2.5.0 * * @global WP_Query $wp_query WordPress Query object. * * @return bool Whether the query is for the front page of the site. */
/** * Filters the callback for killing WordPress execution for XML-RPC requests. * * @since 3.4.0 * * @param callable $callback Callback function name. */
        $callback = apply_filters( 'wp_die_xmlrpc_handler', '_xmlrpc_wp_die_handler' );
    } elseif ( wp_is_xml_request()
        || isset( $wp_query ) &&
            ( function_exists( 'is_feed' ) && is_feed()
            || function_exists( 'is_comment_feed' ) && is_comment_feed()
            || function_exists( 'is_trackback' ) && is_trackback() ) ) {
        /** * Filters the callback for killing WordPress execution for XML requests. * * @since 5.2.0 * * @param callable $callback Callback function name. */
        $callback = apply_filters( 'wp_die_xml_handler', '_xml_wp_die_handler' );
    } else {
        /** * Filters the callback for killing WordPress execution for all non-Ajax, non-JSON, non-XML requests. * * @since 3.0.0 * * @param callable $callback Callback function name. */
global $wp_query;

    $datetime          = false;
    $max_modified_time = false;
    $utc               = new DateTimeZone( 'UTC' );

    if ( ! empty( $wp_query ) && $wp_query->have_posts() ) {
        // Extract the post modified times from the posts.         $modified_times = wp_list_pluck( $wp_query->posts, 'post_modified_gmt' );

        // If this is a comment feed, check those objects too.         if ( $wp_query->is_comment_feed() && $wp_query->comment_count ) {
            // Extract the comment modified times from the comments.             $comment_times = wp_list_pluck( $wp_query->comments, 'comment_date_gmt' );

            // Add the comment times to the post times for comparison.             $modified_times = array_merge( $modified_times$comment_times );
        }

        // Determine the maximum modified time.         $datetime = date_create_immutable_from_format( 'Y-m-d H:i:s', max( $modified_times )$utc );
    }

    
Home | Imprint | This part of the site doesn't use cookies.