Skip Navigation

[Resolved] Template files

This support ticket is created 6 years, 4 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.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 13 replies, has 4 voices.

Last updated by Christian Cox 6 years, 4 months ago.

Assisted by: Christian Cox.

Author
Posts
#1077687
Screenshot 2018-08-08 16.59.32.png

I’ve created a custom post type called “News Items”

All I want to do (for now) is add a custom field where a URL can be input and displayed after the content of the post. I don’t want to change the post template, single.php, but I’m getting a message: Your theme’s template file single.php for displaying News items is missing custom fields.

How can I fix?

#1078302

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Tim

When you use Toolset to create non-PHP templates for your single posts, the single.php template is still being used.

Examine such a PHP template and you will normally find that as well as the post title and various post meta, the post body is output using the WP function the_content().

*That* is what is replaced by a Content Template made with Toolset.

So, if you go to Toolset > Content Templates and make a new template for your post type, and then insert the post body (using the Fields and Views button) into the template and nothing else, then the post will look just the same as if it were rendered solely by single.php.

But you can now add additional fields—in your case, this URL field—to the template, before or after the post body, and you can use whatever markup you want.

#1078654
Screenshot 2018-08-09 12.25.00.png
Screenshot 2018-08-09 12.21.30.png
Screenshot 2018-08-09 12.21.43.png

Thanks very much. Making progress here. But what I want is for the featured image to NOT cover the entire row. Enclosing screenshots. I created a widgetized sidebar (shown).

#1079608

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello TimF454 - Nigel is on Vacation. This is Minesh here and I'll take care of this ticket and try to help you further. Hope this is OK.

Well - I need to first look at with your post type setup to know from where the Feature Image is coming from and once I review that I'll be able to guide you in right direction.

Could you please share problem URL and access details.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

#1079734

ghk

#1081308

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - It looks like the Featured Image is controlled from the Header part of your theme and Toolset Content Template only control the Body (the_content()) part of the theme.

Please check from where the Featured Image is displayed from your theme - if its displayed from Header part of theme, Toolset cant able to control it.

#1081478

Well, I don't know "from where the Featured Image is displayed." I checked header.php, which you could do, and didn't see any references.

Please give me answers or suggestions ASAP, not what you can't do. I would appreciate it.

#1081572

PLEASE -

Is there any way I can talk to someone in my Pacific time zone? Having to wait for 24 -36 hours each time I ask a question is intolerable!

If I had known this would be considered "support," I wouldn't have bought the plugin.

#1081604

Hello, we don't have a supporter available in the Pacific timezone but I'm on the east coast and we should be able to communicate more effectively that the other two supporters on this ticket. I read the comments so far and it looks like the main issue right now is you would like to have a featured image that does not span the entire width of the page on News Items posts. Since Toolset's Content Template feature does not give you the ability to modify elements outside of the main content area, that means you must take another approach here. The options are
1. Copy the single.php template file from the parent Alone theme and paste it into the child Alone theme. Rename the file single-news-items.php. Activate the child theme. Now this template file will be applied to all News Items posts, reflecting the same design as a blog post. Note that in this approach, Toolset's Content Templates can still only control the main content area, which does not include the sidebar.
2. Use custom CSS to hide the featured image at the top of the page, then add the featured image and overlay text inside the Content Template using shortcodes. Note that in this approach, your custom widgetized sidebar can still be used.

Let me know if you have questions about either approach, and then you can make a decision and I can help you move forward.

#1081606

Thank you Christian! I will try option #1 and get back to you. Much appreciated.

#1081641

Hi Christian,

I re-read your message and it looks like Option 2 would be better. I've hidden the featured image with CSS. Trying to find shortcodes for featured image and overlay text.

#1081645

You can use the Fields and Views button above most editor panels to insert various custom fields and post information, like the number of comments, featured image, post date, author, or post title. Documentation for those shortcodes and their available options can be found here:
https://toolset.com/documentation/user-guides/views-shortcodes/
https://toolset.com/documentation/customizing-sites-using-php/functions/

Number of post views is not built-in to WordPress, so I'm not sure how your theme displays that value. It could be a custom field defined by your theme, or it could be added by another 3rd-party plugin.

#1081646

OK, I've got the image set. But the sidebar isn't showing up. Did I make a mistake by adding a category "News" in addition to the custom post?

#1081655

OK, I've got the image set. But the sidebar isn't showing up.
I see the sidebar header "Recent Articles" but I don't see any posts appearing. Since the sidebar widget is part of the theme's files, there's not much I can offer here, you may need to ask their support team. It may not be designed to work on custom post types. Here's the theme file responsible for the widget: hidden link
One way to get around this is to replace the theme's widget in the Content Template with a View that shows similar results. You can filter the View and order the results by post date.

Did I make a mistake by adding a category "News" in addition to the custom post?
Hard to say, I'm not an expert with this theme and its nuances. Generally speaking, they have different slugs so you should be okay.