[Resolved] Specific display for custom taxonomie

Home Forums Support [Resolved] Specific display for custom taxonomie

Home Forums Support Specific display for custom taxonomie

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #242696
    Thierry

    Hello,

    I use this plugin : https://wordpress.org/plugins/custom-post-type-ui/

    For a specific taxonomies i want display (or not display) the elements (sidebar, read more)

    I think make a copy og archives.php but after ? what is the process ?

    Thx

    #242776
    Tom
    Lead Developer
    Lead Developer

    You would make a copy and then name it to match the post type: https://developer.wordpress.org/themes/basics/template-hierarchy/#custom-post-types

    #242810
    Thierry

    Great and for customize this page how i can di this ?

    #242978
    Tom
    Lead Developer
    Lead Developer

    You would just take the copied file, rename it and then add your customizations to the code.

    #245156
    Thierry

    Hi, ok but where i can found an exemple for i understand the customisation of this specific file ?

    thank you so much

    #245184
    Thierry

    I begin to understand but I need help.

    I copy content.php and i create content-news.php for a specific layout, if i want 2 sidebar whow i can code this ?

    #245212
    Tom
    Lead Developer
    Lead Developer

    Sidebar layouts can be altered using a filter: https://generatepress.com/knowledgebase/choosing-sidebar-layouts/#sidebar-filter

    So if your custom post type is named “news”, you could do something like this:

    add_filter( 'generate_sidebar_layout','generate_cpt_sidebar_layout' );
    function generate_cpt_sidebar_layout( $layout )
    {
     	// If we are on a woocommerce page, set the sidebar
     	if ( 'news' == get_post_type() )
     	 	return 'both-left';
    
     	// Or else, set the regular layout
     	return $layout;
     }
    #245669
    Thierry

    ok Tom, step by step i I advance and now my problem is displaying ACF field in the sidebar for the single page. You think a solution ?

    #245760
    Tom
    Lead Developer
    Lead Developer

    If you want it in a widget, you’ll need to make a shortcode with your ACF field.

    Might be worth asking them what the best way is.

    #245789
    Thierry

    simply, great πŸ™‚

    thank you Tom, last thing if i want modify a sidebar only with code, it’s possible ?

    #245890
    Tom
    Lead Developer
    Lead Developer

    What exactly are you modifying? You can choose to display sidebar using the code I posted above: https://generatepress.com/forums/topic/specific-display-for-custom-taxonomie/#post-245212

    #246310
    Thierry

    Yes i think that’s ok, thx Tom πŸ™‚

    #246323
    Tom
    Lead Developer
    Lead Developer

    You’re welcome πŸ™‚

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