Ultimate Branding. Admin panel tips issue.

This is from module "Admin panel tips":

$content = $post->post_content;
if ( ! empty( $content ) ) {
printf( '<div class="apt-content">%s</div>', apply_filters( 'the_content', $content ) );

Note that it hooks the_content. But that hook only applies within the loop.
This code isn't running in the loop, it's a custom iteration through an array of tips posts.

Right above that code is a call to hook the_title. Similar issue, hook handlers are expecting a post ID and other data that isn't available.

$title = $post->post_title;
if ( ! empty( $title ) ) {
printf( '<h4>%s</h4>', apply_filters( 'the_title', $title ) );
  • Rupok
    • Support Ninja

    Hi Tony G,

    Thanks a lot for reporting. I'm pinging our SLS (Second Level Support) team to check this. We will update you here as soon as we get anything from them regarding this.

    Please keep in mind, our SLS people work around the clock and they have to deal with lots of critical issues and other things. So it may take a little while for them to check this and provide their valuable opinion on this. I will appreciate your patience.

    Have a nice day. Cheers!

  • Panos
    • SLS

    Hey there Tony G !

    Apologies for not getting back to you here!

    Those filters can be used in admin edit pages. For example activate a Tip for MarketPress Store pages:

    // Tip title : "Manage PRODUCT_NAME"
    add_filter( 'the_title', function( $title ){
    	global $post;
    	return str_replace( 'PRODUCT_NAME', $post->post_title, $title );
    } );
    // Tip content : "Make sure you add the proper price for PRODUCT_NAME"
    add_filter( 'the_content', function( $content ){
    	global $post;
    	return str_replace( 'PRODUCT_NAME', $post->post_title, $content );
    } );

    In the above example it would replace the PRODUCT_NAME with the actual product name in title and content. It's a simple example, but I hope it managed to explain that it could be useful in some cases :slight_smile:

    Kind regards!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.