- This topic has 5 replies, 2 voices, and was last updated 3 years, 11 months ago by
David.
-
AuthorPosts
-
May 18, 2022 at 4:40 am #2223499
Wim
Hi team,
I have a question regarding how to approach the the implementation of a real estate plugin with it’s own archive, functions, loop and single.php file, located in a sub directory of the theme. I hope I explain in well enough, but here goes.
This real estate plugin come with it’s own php theme files – as mentioned above – which are located in a directory inside my child theme (child of GeneratePress). These files take care of displaying the properties and are meant as an example to style my own. As I understand correct, this real estate module looks for the files in this directory automatically.
Now I would like to style the pages within WordPress as any other page. Is this something that is possible, or do I need style these page myself.
Kind regards, Wim
May 18, 2022 at 5:12 am #2223524David
StaffCustomer SupportHi there,
thats correct WP’s template hierarchy will check the Child Theme first, so if they are correctly located then they should be used.
Now GP won’t know the templates exist, and therefore styling those templates will either come down to:
a. Using custom CSS or any hook APIs the plugin developer provided.
b. editing the PHP Templates to fall in line with GPs – you could try comparing its single.php with ours:https://github.com/tomusborne/generatepress/blob/master/single.php
May 18, 2022 at 5:36 am #2223557Wim
Thx for the quick response David. It is a bit more clear to me now.
The theme files I was talking about are not in the root of the child theme though. They are located within a directory within the child theme. They seem to be used only for a custom post type the real estate plugin creates.
So for the site in general, the default theme files of GeneratePress will be used.
What I want to accomplish is to style these plugin theme files, according to GP settings. To be more precise, mainly the structure part of styling. So for instance if I choose in GP to change the with of the site container from 1200 to 1100, these changes are also noticeable for the plugin theme pages.
May 18, 2022 at 7:59 am #2223851David
StaffCustomer SupportYou would need to create for example a single.php that is a hybrid of GPs single.php and your plugins.
see here:I highlight the loop in GPs single.php. The loop is where the relevant content template is called.
Everything around the loop provides the pages structure.So it may be a case of using our template and replacing the loop with the plugins template.
As a note – the way GP works for displaying the content is the
generate_do_template_part' function in side the loophttps://github.com/tomusborne/generatepress/blob/a3ce1712ab1cc705fed577fad8fa9ea8c04d5d20/single.php#L29Which in this case returns our
content-single.phphttps://github.com/tomusborne/generatepress/blob/master/content-single.php
Not sure if that helps 🙂
May 19, 2022 at 2:25 am #2225100Wim
Thanks David, I will look into your suggestion.
May 19, 2022 at 4:06 am #2225226David
StaffCustomer SupportYou’re welcome
-
AuthorPosts
- You must be logged in to reply to this topic.