Skip Navigation

[Closed] Displaying a specific post's specific data in another page's view

This support ticket is created 7 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 5 replies, has 2 voices.

Last updated by andres.c 7 years, 3 months ago.

Assigned support staff: andres.c.

Author
Posts
#330172

Basically what I'm trying to do is to create a custom header. The way I try to do this may not be the best practice but I didn't find any info on how to make a custom header with VIEWS.
So I created a custom post type: Site info.
I created one post in this type, and I added all the info for the site, including the logo image.

Then I created a header VIEW, in which I would like to display this logo, by refering to the Site info post's image - and not by using a static image.
I tried this code but it didn't work.

Logo comes here: <img [types field="website-logo" alt="Site logo" title="Site logo" width="100" height="100" align="center" resize="proportional"][/types] />
Main menu is here: [listmenu menu='Main menu']
[types field="website-name"][/types]
[types field="site-description"][/types]

Apparently I am not refering to the right object, but I don't know how to refer to one particular post's field. Any ideas?
Or maybe a better idea how to make a custom header?
Thanks.

#330235

andres.c
Supporter

Welcome to Toolset support forum,

With images Types fields, there is no need to wrap your shortcode inside the <img> tag. You could try doing the following:

[types field="website-logo" alt="Site logo" title="Site logo" width="100" height="100" align="center" resize="proportional"]

However, from your precedent post, I know you are using Layouts as well. So, maybe another possible approach for your header could be to make use of layout hierarchy. The main idea is to create a parent template with layouts where you will create your header (and footer or sidebars if applies), and then, you'll wrap you content into a child template inside this parent template. That way, you could manage your header from one specific place making use of Layouts.

You can find a more detailed information here:
https://toolset.com/documentation/user-guides/hierarchical-layouts/

I hope it points you into the right direction.

Regards,
Andrés

#330480

Thanks for the idea, I'll try the hierarchical layout.
Is this going to change my default header.php and footer.php files? Or do I have to somehow remove those from the picture and only use layouts on the page?

#330639

andres.c
Supporter

It is not going to remove those files, but you'll need to recreate them into your Parent template with your Layouts editor.
Let me know if it works !

#330742

How do I tell WordPress not to put the default header and footer on my page if I create other header and footer with Layouts?

#330919

andres.c
Supporter

Once you are able to select a Layout, it would override your theme configuration for any page where you select this Layout.
However I'm still checkin what it's going on with your pages.php configuration.

The topic ‘[Closed] Displaying a specific post's specific data in another page's view’ is closed to new replies.