Can’t get page content in WordPress

Wrap the_content() function like below $args = array( ‘post_type’ => ‘your-custom-post-type’, ); $query = new WP_Query( $args ); while( $query->have_posts() ): $query->the_post(); the_content(); endwhile; wp_reset_postdata(); one thing to note here though, you must know where to end the loop ( i.e., endwhile; ) as you’ve other markup in the page template ( I assumed that … Read more

Combine two different filter callback functions

I think you could or even should combine your filters to keep your code DRY. add_filter(‘script_loader_tag’, function( $tag, $handle ) { if ( ‘chargebee’ == $handle ) : return str_replace( ‘ src’, ‘ data-cb-site=”mydomain” src’, $tag ); elseif( ‘google-maps’ == $handle ) : return str_replace( ‘ src’, ‘ async=”async” defer src’, $tag ); endif; return … Read more

Get_avatar filter?

I am giving you example from storefront WordPress theme because it’s the best theme which explains everything what you want to know so here the code which is in it’s comments.php <ol class=”comment-list”> <?php wp_list_comments( array( ‘style’ => ‘ol’, ‘short_ping’ => true, ‘callback’ => ‘storefront_comment’, ) ); ?> here storefront_comment is a callback function which … Read more

Add function to every post?

One way to do that is to have the custom dropdown function return the custom html. Then you can call it inside your add_dropdown_to_posts and put the returned content into a helper variable. After that just prepend the custom html to the $content variable that the the_content filter provides. Like this, function my_custom_dropdown_html() { return … Read more