[Resolved] Display Custom Post Types in Tags in Colums

Home Forums Support [Resolved] Display Custom Post Types in Tags in Colums

Home Forums Support Display Custom Post Types in Tags in Colums

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1938476
    Oladipo

    Hello GeneratePress,

    Thanks for the amazing theme. Please I created a custom post type and assigned the core WP tags to the post type. Now, I activated blog columns on the generate press settings and thanks I was able to display the column on the post types archive pages and custom taxonomy .

    The issue I am having now is this; when I view tags assigned to traditional posts, the column works, but when I view tags which contains the custom post types, the columns refuse to work and only displays in a single column.

    Please how can I resolve this?

    Thanks.

    #1938485
    Oladipo

    Please I would also love to display text at the end of every tag, category and custom taxonomy page. The text I want to display is unique to each term on the taxonomy, I would like to display the text immediately after the pagination how can I achieve this too?

    Thanks

    #1938543
    Elvin
    Staff
    Customer Support

    Hi there,

    You’ll need a PHP snippet to enable the columns for custom post type.

    Here’s the code snippet you’ll need – https://docs.generatepress.com/article/using-columns-in-the-blog/#adding-columns-to-your-custom-post-type

    Please I would also love to display text at the end of every tag, category and custom taxonomy page. The text I want to display is unique to each term on the taxonomy, I would like to display the text immediately after the pagination how can I achieve this too?

    It depends on where the text will come from. Is it going to be dynamic coming from a custom field? Can you explain a bit more?

    #1938668
    Oladipo

    Thank you for your response.

    I have seen this guide and I used it to make the Columns appear on the custom post type archive page. Now I need to make the tags archive display the columns and custom post type, please how can I achieve this?

    For the text on the tag page, I want to place a box like the description box that will on every tag term and allow you add content into it, then this content will be displayed on the end of content, just the description of the tag appears before the content.

    #1938676
    Elvin
    Staff
    Customer Support

    I have seen this guide and I used it to make the Columns appear on the custom post type archive page. Now I need to make the tags archive display the columns and custom post type, please how can I achieve this?

    Does the custom post type share the same “Tags” taxonomy the default post type uses? IF yes, then these CPTs should automatically show up on the archive page of the default “Tags” terms.

    If the custom post type has its own custom taxonomy “Tags”, this custom taxonomy “Tags” associated to the CPT will have its own archive page.

    Now if you have 2 “Tags” taxonomy between the default post type and your custom post type, you may have to do a pre_get_posts filter to add the query for the custom taxonomy “Tags” to the default taxonomy “Tags”.

    But if you’re simply trying to add columns to the default taxonomies that come with WordPress, this option should be enough – https://docs.generatepress.com/article/using-columns-in-the-blog/

    We only use the PHP snippet so the Customizer settings apply to the custom post type. 😀

    For the text on the tag page, I want to place a box like the description box that will on every tag term and allow you add content into it, then this content will be displayed on the end of content, just the description of the tag appears before the content.

    Not exactly sure what you mean. Are you trying replace the default tag term description to a dynamic text value? If yes, can you specify where the dynamic text value will come from? Do you have a custom field assigned to the tag terms?

    Let us know. 🙂

    #1938720
    Oladipo

    Does the custom post type share the same “Tags” taxonomy the default post type uses? IF yes, then these CPTs should automatically show up on the archive page of the default “Tags” terms.

    Yes, the CPT shares the default Tags which post uses, but it is not displaying the column grid. This is the code I used to connect the CPT to the tags

    add_filter( 'pre_get_posts', 'cll_add_custom_types' );
    
    function cll_add_custom_types( $query ) {
    	
       if( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] )) {
    	   
         $query->set( 'post_type', array( 'post', 'books', 'ebooks', 'audiobooks') );
          return $query;
       }
    }
    

    I want to add a box like the description box to the tag terms and display that box after the tag content(i.e. posts), while the description box appears at the top by default, the box will appear underneath, after the posts.

    Thanks.

    #1938738
    Elvin
    Staff
    Customer Support

    Can you share the filter conditions you’re using for generate_blog_columns?

    Something like this should be enough.

    add_filter( 'generate_blog_columns','tu_portfolio_columns' );
    function tu_portfolio_columns( $columns ) {
        if ( is_post_type_archive( array( 'post', 'books', 'ebooks', 'audiobooks') ) ||  is_category() || is_tag() ) {
            return true;
        }
    
        return $columns;
    }

    I want to add a box like the description box to the tag terms and display that box after the tag content(i.e. posts), while the description box appears at the top by default, the box will appear underneath, after the posts.

    The appropriate hook to use for this is generate_after_loop. You can hook the description box you’ve created on this hook. It’ll appear after the post loop. Just make sure the display rule location for the block or hook element you’ve created the description box on is correct. 🙂

    #1939017
    Oladipo

    WOW! It worked perfectly.

    Thank you.

    Also, please how can I create the the description box?

    Thanks so much

    #1939056
    David
    Staff
    Customer Support

    Hi there,

    you can use a Block Element:

    https://docs.generatepress.com/article/block-element-overview/

    Add a GenerateBlocks Container Block, which you can use to style and set the contents typography.

    Then inside the Container Block add a GP Dynamic Content Block:

    https://docs.generatepress.com/article/dynamic-blocks/#dynamic-content

    And set it to Term Description.

    You can then set the Block – Hook to after_main_content and its Display Rules to the Archives you want the term description displayed on

    #1939512
    Oladipo

    Thanks so much for the amazing support.

    God bless you guys!

    #1940058
    David
    Staff
    Customer Support

    Glad we could be of help!

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.