Archived topic
Change Template on a Page with A Dynamic Slug
10 replies · Started by adam on November 7, 2017
I'm using a job board plugin, and it generates pages dynamically with a unique slug. These pages (job descriptions) default to automatically reference the template with sidebar right. Any idea how I can target just that slug hierarchy and apply a full width template to all child pages with that slug?
Hi there,
What's the slug? Just checked the home page you linked and I don't see anything in the body tag.
Can you link me to a page with that plugin activated?
The slug is 'indeed-jobs', but that's being generated from the plugin. I'm not sure why you don't see any content in the body tag. You looked at the homepage or the link I sent?
sorry, go to /job-listings
Hmm there isn't indeed-jobs in the body tag that I can see.
Here are all the body tags in one of the job listing pages: https://s1.postimg.org/72m4uvhv0v/2017-11-07_0857.png
Maybe try this?
.ehf-template-generatepress .sidebar {
display: none;
}
Adding CSS: https://docs.generatepress.com/article/adding-css/
The .sidebar is displaying as none now.
Just to make sure...so it's working?
Hi Leo,
This issue is still unfixed...Here's a link to the "Job Listings" page.
http://633.ea8.myftpupload.com/job-listings/
Once you click on a job, and go to the job description page, instead of passing the content through and using the same template, the dynamically created description page is loading the default template with sidebar. Is it possible to override the default template to the same full width template, instead of the sidebar template?
BTW, I did remove all plugins and started from scratch with nothing but the indeed plugin and the gp theme. Still having the same issue.
Do you have access to edit this dynamically created page once it's been created?
Usually we can use this filter: https://docs.generatepress.com/article/generate_sidebar_layout/
However, I'm not sure what the conditional would be to make sure we were on pages specific to job listings. Usually instead of creating pages, you would use a custom post type to create a "Job Listings" type, and then we could target the pages inside that post type.
Actually there were a few things messing with the layout. The "Header Footer Elementor" plugin (I used it for my footer), was injecting some strange padding in there, but more importantly, the sub menu item had a height: 100% which pushed the main content way down. Thinking that came from the GP parent theme though so maybe check that out. I fixed by changing this css:
.menu-item-has-children .dropdown-menu-toggle {
height: inherit;
}
Thanks!
Glad you figured it out!