Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #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?

    #887138

    I’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?

    #887674

    Hi,

    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,
    Ismael

    #887916

    I 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.

    #887925

    I 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.

    #887928

    While 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?

    #887960

    Hi brian7454,

    Yes, it is correct. Have you tried it?

    Best regards,
    Victoria

    #887970

    No, I only found the post referring to it. But Ismael says it cannot be done in a child theme, which is confusing.

    #888323

    Hi,

    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.

    // http://kriesi.at/documentation/enfold/add-new-or-replace-advanced-layout-builder-elements-from-child-theme/

    Best regards,
    Ismael

    #889366

    Unfortunately 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.

    #889470

    Hi,

    The snippet above allows you to modify the shortocdes in a child theme. Add the snippet in the child theme’s functions.php file then create a shortcodes folder. Add any shortcode or element that you want to override.

    Best regards,
    Ismael

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.