Upfront, FrontPage, Regions, CMS, taxonomy

Hello,
This is the use case that I would like to get a clear direction.
1- Using upfront to create a magazine implementation
2- Custom Post Types, and Taxonomy used for categorizing posts
3- On the front page, will need to show the most recent post, or specifically selected post per specified taxonomy.
4- When #3 is clicked. it leads to a page where all taxonomy posts are shown in 'excerpt' format, which specifically chosen fields. One when an 'excerpt' is clicked does it lead to the full post itself.

This scenario requires CMS functionality using Upfront. My challenge has been to setup or create a taxonomy based widget (showing only certain fields of the most recent post) that can be placed in Upfront regions.

It should be straight forward, but my experience in WP is in its infancy, so your guidance would propel the direction. There is an external plugin called Views from, but I am certain there are other ways to do this without buying a plugin.

Thanks

  • Michelle Shull

    Hi there, Zarrar!

    How about we make a shortcode for your custom taxonomy list? Then we can drop it in a widget, or wherever else you might need it.

    To start, we're going to create this shortcode in an mu-plugin, so it won't be overwritten when your them updates. Here's a guide on that.

    Next, you're going to create a function in your site-specific plugin.

    // Create the new function
    function list_terms_custom_taxonomy( $atts ) {
    
    // Tell the function what you want it to grab
    
    	extract( shortcode_atts( array(
    		'custom_taxonomy' => '',
    	), $atts ) );
    
    // arguments for function wp_list_categories
    $args = array(
    taxonomy => $custom_taxonomy,
    title_li => ''
    );
    
    // Wrap it in unordered list
    echo '<ul>';
    echo wp_list_categories($args);
    echo '</ul>';
    }
    
    // Add a shortcode that executes our function
    add_shortcode( 'ct_terms', 'list_terms_custom_taxonomy' );
    
    //Allow Text widgets to execute shortcodes
    
    add_filter('widget_text', 'do_shortcode');

    You'll need to customize the arguments to display or not display the elements you want in the text widget.

    After this, you can use this shortcode: [ct_terms custom_taxonomy=customtaxonomyname]

    With your custom taxonomy slug in place of "customtaxonomyname."

    Here's more on this process, for further reading.

    Hope this helps!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.