[Support request] Template of GP in draft posts

Home Forums Support [Support request] Template of GP in draft posts

Home Forums Support Template of GP in draft posts

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #278691
    Mario

    I have literally more than 2000 posts to be published. However, I would like to change some configurations of these drafts:
    – Page header – Logo – Choose Logo (with a specific image obviously)
    – Sidebar / Content

    My preconfiguration is different from those above mentioned.

    How can I make a template with those two changes to be applied on those 2000 posts automatically, instead of modifying them manually one by one?

    #278705
    Leo
    Staff
    Customer Support

    Hi Mario,

    Are there any logic to which of the 2000 posts you would like those two changes to apply to? Like are they a specific category?

    If not then I think you would have to do it with the similar way as swapping out logos with php, if statements and page slug.

    #278707
    Leo
    Staff
    Customer Support
    #278957
    Mario

    Hi Leo,
    Answering your first comment, I would say yes, all those yet unpublished posts present one common category.
    I’ve been checking out the links you posted, but I am a little bit lost…

    #279104
    Leo
    Staff
    Customer Support

    Ok then you would use the generate_sidebar_layout filter and do something like this:

    add_filter( 'generate_sidebar_layout','tu_custom_category_sidebar_layout' );
    function tu_custom_category_sidebar_layout( $layout )
    {
     	// If we are on a category, set the sidebar
     	if ( is_category( 'Whatever' ) )
     	 	return 'left-sidebar';
    
     	// Or else, set the regular layout
     	return $layout;
    
     }

    https://docs.generatepress.com/article/sidebar-layout/#using-a-function

    Adding PHP: https://docs.generatepress.com/article/adding-php/

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