Tagged: loop-index.php
-
AuthorPosts
-
December 8, 2017 at 4:27 pm #886540
Hi,
I have a couple of customised templates., archive and single, used to display cpt. I have noticed a strange problem that I just cannot get around:
With a customised single.php, I replaced
get_template_part( ‘includes/loop’, ‘index’ );
with
get_template_part( ‘includes/singleadoptloop’, ‘index’ );
Then I added a file called singleadoptloop-index.php in my child/includes folder. THAT works a treat and has done for 3 years.With a customised archive.php I cannot do the same. I created a custom archive.php template and made various changes inside that. Text that sits in a div before the posts are called, and an alternative layout in the footer, for example. That all works a treat and has done for 3 years.
Recently, I realised I needed to change the way posts are displayed on the archive page – basically I want to add an image overlay to posts which have a specific value in a custom field. I’ve done it many times in avada and assumed I’d be able to do it with enfold too (basically the posts are for animals awaiting adoption, and instead of deleting adopted animals we now want to overlay an ‘adopted’ png over the post thumbnail).
I assumed that the file that I need to edit in order to add the necessary html (and so on) would be loop-index.php
So, inside my custom archive template I replaced
get_template_part( ‘includes/loop’, ‘index’ );
with
get_template_part( ‘includes/archiveadoptloop’, ‘index’ );
and placed the appropriate file in the includes folder.Unfortunately, this doesn’t work. I can do anything to the customised template and it doesn’t change a thing, including deleting a random block of its code (which would normally trigger errors or fatal errors). It put get_template_part( ‘includes/loop’, ‘index’ ); back in the custom archive template and copied the standard loop-index.php file into my child/includes folder. Again, the version in the child/includes folder was ignored. I tried butchering the code, and this was ignored too.
Desperate to find out what on earth was going on, I went into the parent enfold folder and renamed the loop-index.php file.
That did nothing at all.The only file I can see the archive template calling is the loop-index file, so I’m confised as hell….
It looks to me that I’m trying to customise the wrong file. Can you tell me, which file do I need to customise (in a child setup) when I want to customise the post archive blog output?
December 10, 2017 at 9:48 pm #887138I’ve been browsing various posts here and digging through theme files.
Maybe I should go over what I need to do, for clarity To explaion, I will actually explain what I normally do with other themes, because it seems enfold is different.
On a different site, I have a custom post type which also uses custom fields.
One of those custom fields is call ‘sold’ and is either empty or has a value ‘yes’.I have a customised single-cpt.php file to deal with single posts
I have a customised archive-cpt.php file to deal with the archive display. In the course of customising the archive page, I add my own php and html. This includes adding a simple ‘if’ statement which looks at the custom field ‘sold’ and adds a div containing an image which is overlaid with css over the post thumbnail if the ‘sales’ field is not empty (which means it must say yes, and means the item is sold). It’s an incredibly simple modification to make, even in complex themes like avada.I wanted to do the same thing with Enfold, except the field would be called ‘rehomed’.
However, enfold’s archive.php file only deals with what comes above and below the blog output. It includes a get template part, which calls loop-index.php but changing this doesn’t make any difference to anything, as if the file had no purpose at all.
I found reference in another post (https://kriesi.at/support/topic/remove-excerpt-only-from-blog-archive/#post-700977) to a file called postslider.php, which was referred to by a moderator. I copied that to my child theme. Modifying it didn’t actually make any difference.
Modifying a blog archive page, be it to add html or maybe a little php, should be simple, so for the life of me I can’t understand why I can’t do something so childishly simple. Plainly, I’m missing something.
Can you tell me how one makes this change in enfold?
December 12, 2017 at 3:08 am #887674Hi,
Thank you for using Enfold.
The blog posts element relies on the loop-index.php unless the blog style is set to “Grid Layout”, then you’re gonna have to modify the postslider.php file. Also, please note that you can’t override the postslider.php file in a child theme.
Best regards,
IsmaelDecember 12, 2017 at 1:36 pm #887916I am using the grid layout. So how do I modify the blog archive output, using grid layout? Trying it by means of modifying the parent theme would be insane, as I’d lose those modifications on a regular basis and need to know/remember what had been modified and re-modify the theme each update.
I mean, modifying the blog page can’t be so complicated, surely? It’s a remedial-level task normally.
December 12, 2017 at 1:47 pm #887925I don’t get why can’t postslider be modified in a child theme.
In any event, what I want is a simple 3-col blog output, whatever it’s called, which allows me to add some simple html wrapped in a simple if statement. I’ll be honest and say I’m stunned that something so simple should be so difficult in enfold, which is normally pretty accessible when it comes to simple customisations.
December 12, 2017 at 1:49 pm #887928While searching through other tickets, I just found this from September this year:
https://kriesi.at/support/topic/custom-category-icon-at-blog-post-title/#post-850418
Was the advice given not correct?
December 12, 2017 at 3:21 pm #887960Hi brian7454,
Yes, it is correct. Have you tried it?
Best regards,
VictoriaDecember 12, 2017 at 3:44 pm #887970No, I only found the post referring to it. But Ismael says it cannot be done in a child theme, which is confusing.
December 13, 2017 at 1:28 pm #888323Hi,
Yes, the shortcodes can be modified in the child theme but we don’t recommend it because it’s going to override the parent theme’s shortcode completely. What if there are features or modifications added in the parent theme’s shortcode? The workaround in the previous thread works best if you’re going to create a custom shortcode or element.
Best regards,
IsmaelDecember 15, 2017 at 6:42 pm #889366Unfortunately that links shows me a code snippet that means nothing to me at all. I’m confused as to why enfold’s creators have actually made minor modifications to fundamental templates significantly harder to make. Adding a snippet of html and a simple ‘if’ instruction to an archive or post template is something that is as far from rocket science as Trump is from being a coherent President. Yet enfold requires the creation and insertion of shortcodes and/or modification of parent theme files to do this? I mean, that’s just plain silly.
December 16, 2017 at 4:20 am #889470 -
AuthorPosts
- You must be logged in to reply to this topic.