Okay
  Public Ticket #3362277
loop-markup.php
Closed

Comments

  •  17
    TheSnapAgency started the conversation

    Hi, 

    I'm trying to override this file: loop-markup.php that is located here: salient-core/includes/post-grid/loop-markup.php

    I've tried a fe different options of adding it to my child theme and also adding this code to my functions file to override it but nothing is happening

    // Override the loop markup file in the Salient Core plugin
    add_filter( 'nectar_post_grid_loop_markup_path', 'custom_post_grid_loop_markup_path' );

    function custom_post_grid_loop_markup_path() { return get_stylesheet_directory() . '/salient-core/post-grid/loop-markup.php';
    }


    can you help

  •  8,944
    Tahir replied

    Hey Again,

    Which function are you trying to edit in the loop markup file ?. You can simply override the functions in a Child Theme if needed as the functions are compatible with Child Theme Overrides. See screenshot: 

    3473083699.png

    Thanks 


    ThemeNectar Support Team 

  •  17
    TheSnapAgency replied

    Hi Tahir,

    I'm trying to add html to this code within the loop-markup.php file. It would be great to be able to edit this file and then add it to my child theme to override the salient core plugin file.




    Attached files:  Screenshot 2023-05-04 at 09.30.24.png

  •  8,944
    Tahir replied

    Hey Again,

    I believe that code you referenced is within the function that can be overridden via a Child Theme so its much easier to just copy paste the function and make the edits to it. 

    Escalating this to the developer to check if the whole file can be overridden . 

    Thanks


    ThemeNectar Support Team 

  •  17
    TheSnapAgency replied

    Hi 


    Thanks for this. I have added a function to my functions.php file in the child theme. This adds a "read more" button after the excerpt. I'm trying to move the category outside of the <div class"content"> div but I'm struggling to do this. Using a function would be a good route to go for minor changes like this. It would be handy to be able to override the whole file as sometimes we develop the styles quite a bit.


    /** * Add Read More button after meta-date in post grid */
    function custom_readmore($readmore_markup, $post_type) { global $post; $post_perma = get_permalink($post->ID); $readmore_markup = '<a class="rm-btn" href="' . esc_attr($post_perma) . '">' . esc_html__('Read More', 'salient-core') . '</a>'; return $readmore_markup;
    }

    add_filter('nectar_post_grid_excerpt', 'custom_readmore', 10, 2);


    Thanks

  •  1,086
    ThemeNectar replied

    Hey TheSnapAgency,

    The next version of Salient will include many new options for the Post Grid element and multiple action hooks/filters for various locations in the loop-markup. If you'd like to join the beta program, I can provide a copy of that here for you. If not, the official release will be out in roughly a month.

    Kind regards

  •  17
    TheSnapAgency replied

    Hi

    Thanks for this. Joining the beta program would be useful.

    Are there any other hooks you could provide me other than "nectar_post_grid_excerpt" as I will be able to create another function to achieve moving the category. I'm just not sure on the hooks.

    Essentially I'm trying to make it look like the recent blogs module with the minimal setting

  •   ThemeNectar replied privately
  •   TheSnapAgency replied privately
  •   TheSnapAgency replied privately
  •  1,086
    ThemeNectar replied

    Hey Lloyd, 

    Thanks for the functionality requests! You can just open a ticket on the forum here with requests and we'll get them archived, or alternately feel to reach out via the contact form on my author page in regards.

    ----

    The related posts display currently does not have any hooks you could use to add a read more button to it, but the nectar_related_post_display function can be copied to your child theme from salient/nectar/helpers/blog.php

    You could also adjust the "showposts" query parameter in that function to be 2 instead of the default.

    Kind regards

  •  2
    Denniswhd replied

    Hi, we have the same problem on our website MeinOffice,

    The responses have been very helpful also for me.