WordPress.org

Forums

Menu for post format (6 posts)

  1. nagyv
    Member
    Posted 1 year ago #

    hi,

    I would like to add Quotes to my blog and present them separately under a menu 'Quotes'. I think the best would be to use the "Quote" post format to specify posts as quotes, and show only these posts under this menu.

    Could someone tell me, how can I achieve this?

    thanks
    Viktor

  2. Sage Brownell
    Member
    Posted 1 year ago #

    Do you mean add a link to your nav-bar menu? If so:
    Create a post category called Quotes
    Create a Custom Menu (If you are not using one already)
    There is a box on the Menu page called Categories. Add the Quotes category to the menu

    Hope this helps!
    If it is not what you are after or if you would like me to explain the steps further, please let me know.

  3. nagyv
    Member
    Posted 1 year ago #

    I didn't mean exactly this, but something similar. Instead of using categories I would like to use the post format that I have to specify for every post, and create a menu from these.

  4. vjpo
    Member
    Posted 1 year ago #

    http://codex.wordpress.org/Function_Reference/get_post_format_link
    Аnd google for post format archives. There are quite many articles about it, e.g.
    http://www.chipbennett.net/2011/01/11/using-wordpress-post-formats-as-a-taxonomy/
    The link for a post format archive must be like _http://site.com/type/aside

  5. nagyv
    Member
    Posted 1 year ago #

    Thanks, I've managed to add a menu using

    <?php echo '<a href="' . get_post_format_link( get_post_format() ) . '">' . get_post_format_string( get_post_format() ) . '</a>'; ?>

  6. vjpo
    Member
    Posted 1 year ago #

    I am not sure this way is good for a top menu. There is exhaustive tut in the chapter Taxonomy Sidebar Widget. This variant is more suitable as a part of a top menu.

    $postformatterms = get_terms( 'post_format' );
    if ($postformatterms) {
    	echo '<ul>';
    	foreach( $postformatterms as $term ) {
    		$termslug = substr( $term->slug, 12 );
    		$termname = $term->name;
    		$termlink = get_post_format_link( $termslug );
    		echo '<li><a href="'. $termlink .'">' . $termname . '</a></li>';
    	}
    	echo '</ul>';
    }

    For a WP custom menu may be it's easier to add links manually.

Topic Closed

This topic has been closed to new replies.

About this Topic