• Resolved fgwordpress

    (@fgwordpress)


    Hi,

    I’m very happy with this plugin but i’d like to show a list of all my posts with their secondary title in a widget. When i do this, only secondary title of current page is shown.
    Can you give me a hand to do that ?
    Thank you

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author thaikolja

    (@thaikolja)

    Hi and thanks for your thread.

    It’s relatively easy to show all posts with a secondary title.

    This article shows you how to do it:

    https://rudrastyh.com/wordpress/meta_query.html#query_meta_values

    And what you have to know: Secondary Title’s meta key starts with two underscores: __secondary_title.

    Try this and get back to me if you need any more help.

    Plugin Author thaikolja

    (@thaikolja)

    I didn’t test this, but you can try it:

    $args = array(
    	'meta_query' => array(
    		array(
    			'key' => '__secondary_title',
    			'value' => 'something that is not a secondary title',
    			'compare' => '!='
    		)
    	)
    );
    
    $posts = get_posts($args;
    
    foreach($posts as $post) {
    	echo get_the_title($post->ID);
    	// Do whatever you want
    }
    • This reply was modified 5 years, 5 months ago by thaikolja.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘show all secondary titles in post list widget’ is closed to new replies.