[Resolved] Dsiplay secondary title

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Dsiplay secondary title

This topic contains 7 replies, has 2 voices, and was last updated by  Tom 2 weeks, 6 days ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #11190

    createur
    Participant

    Hi there,

    we installed dispatch from gp site library and also use WP Show Posts Pro:
    https://gpsites.co/dispatch/

    We also installed the Plugin Secondary Title:
    https://wordpress.org/plugins/secondary-title/

    The Plugins outputs the new title via
    <?php echo get_secondary_title(); ?>

    How can we dispay the secondary title on a WP show post list?
    https://prnt.sc/p8945n

    Thank you.

    • This topic was modified 3 weeks, 4 days ago by  createur.
    • This topic was modified 3 weeks, 4 days ago by  createur.
    #11199

    Tom
    Keymaster

    Hi there,

    We can use a hook to add it to your lists. Where exactly do you want it to display?

    Let me know 🙂

    #11203

    createur
    Participant

    Hi,

    Thank you so much!

    Would be nice to display it below the main title.

    Best regards!

    #11225

    Tom
    Keymaster

    Try this:

    add_action( 'wpsp_after_title', function( $settings ) {
        if ( 123 === $settings['list_id'] && function_exists( 'get_secondary_title' ) ) {
            echo get_secondary_title();
        }
    } );

    Just change 123 to the ID of the list you’re targeting.

    #11226

    createur
    Participant

    Thank you so much!

    Is it possible to add more list IDs and a CSS class to this snippet?

    #11247

    Tom
    Keymaster

    Definitely, try this:

    add_action( 'wpsp_after_title', function( $settings ) {
        $lists = array(
            '123',
            '456',
            '789',
        );
    
        if ( in_array( $settings['list_id'], $lists ) && function_exists( 'get_secondary_title' ) ) {
            echo '<div class="your-class-here">' . get_secondary_title() . '</div>';
        }
    } );

    Then just add to the $lists array with the lists you want to target.

    #11266

    createur
    Participant

    You are simply my favorite WordPress developer!
    I love your plugins and GP Theme!

    👍 Thank you very much Tom!

    #11272

    Tom
    Keymaster

    Thank you! Glad I could help 🙂

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.