Viewing 17 posts - 1 through 17 (of 17 total)
  • Author
    Posts
  • #1276543

    Hi,
    i use a masonry to show my blog posts.
    i need to put a “read more” button under every element.
    What code do i have to put in my functions.php??
    (make sure that the “read more” does not show up in the masonry gallery – i am talking about a masonry to show my blogposts!)

    Christian

    #1276664

    Hey DouPaule,

    This is actually something that would require a custom solution and the help of a freelancer. It goes beyond the scope of support here in the forums.

    Best regards,
    Jordan Shannon

    #1278079

    Oh really??
    But others got this help from you.
    Maybe you want to search the forum to find which people got that “customization” while i write a one star rating on Themeforest
    DEAL?

    #1278330

    Hi DouPaule,

    Could you please give us a link to your website, we need more context to be able to help you.

    Best regards,
    Victoria

    #1278460

    i ask a general question and you need context????
    What a pitty that i cant give zero stars on Themeforest….

    #1280342

    Hi,
    Sorry for the very late reply, to add a “read more” link to your masonry elements you can use this script.

    /* Add a "read more" link" to masonry elements */
    function ava_custom_script_mod(){
    ?>
    <script>
    (function($){
      $(window).on('av-height-change', function() {
        $('.av-masonry-entry').each(function() {
          var more = $(this).find('.av-masonry-read-more');
          var cont = $(this).find('.av-masonry-entry-content');
      
          if( more.length == 1 ) return;
          cont.append('<div class="av-masonry-read-more">Read more</div>');
        });
      });
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'ava_custom_script_mod');

    This doesn’t effect the masonry gallery element because it doesn’t include the av-masonry-entry-content class.

    Best regards,
    Mike

    #1281384

    Hello Mike,
    thank you.

    I can see by the result and by the already existing class “av-masonry-read-more” that at least it was planned to implement that as a feature, right?
    There are questions regarding that:
    1: Why isnt it?
    2: Why do your collegues (at least Jordan) treat a question like that like something Enfold customers should pay for?

    Issue:
    The button makes the blogentries overlap with the entries from the next row.
    I tried to find the class that defines the bottom-margin from the masonry blogentries, but i couldnt.
    What is the approprieta class to fix that?

    Christian

    #1281763

    Hi,
    Glad to hear that helped, I don’t find any reference to “read more” being added to masonry items, and as I’m sure you have noted, the masonry element only offers:
    Display Title and Excerpt
    Display Title
    Display Excerpt
    Display Neither

    So we could continue with the above solution, or I can submit a feature request to add “Read More” to the masonry element.
    If you would like to continue with the above solution, then it would help me if you would post a link to your test page, adjusting padding and margin should be easy to do, but not by removing a class, by adding css.
    I see above you don’t seem to want to post your link, but there are many theme settings that change the layout even in the same demo, so while I can adjust this on my localhost, typically this doesn’t always translate exactly to the customer’s (your) site.
    I hope that makes sense.

    Best regards,
    Mike

    #1281988

    Hi,
    i work on localhost, so there is no way to show you, except you come along for a coffee.

    Can you at least tell me what the class/Id is which increases/decreases the margin of the isotope/masonry entry elements??
    Whatever i try to grab with my inspector ….i cant get the appropriete element.
    It has:
    Always Display Title and Excerpt on the bottom of the element

    “a feature request to add “Read More” to the masonry element” cant be so wrong.
    Here are users which have had a support in this case:
    https://www.google.com/search?client=firefox-b-d&q=site%3Akriesi.at+read+more+masonry

    #1282202

    Hi,
    Ok, I tested the masonry element in the Enfold 2017 Demo, and used the script above and the “read more” link shows in the av-masonry-entry-content entry-content div above the av-masonry-date div:
    2021-02-19_054626.jpg
    and so there is no overlap.
    The av-masonry-entry isotope-item div is the actual masonry item div and it has no margin or padding.
    It sounds like you have other custom css that is displacing the inner elements, try removing your custom css and see if it looks similar to my screenshot above.
    Another option would be for you to create another local instance using the 2017 Demo, to achieve the result above, and then you can test and examine the difference between your two sites and how to implement this on your site.
    Please note, that I do not mean for you to import the 2017 Demo into your current working localhost site, this would overwrite your site, you would need to create a new WP localhost site.

    Best regards,
    Mike

    #1282606

    ISSUE

    Your code also produces a button in the masonry gallery and this is exactly what i mentioned not to want in my first, initial post in this thread.

    Here is the task again:
    – Button in masonry portfolio for blogposts
    – No button in gallery

    Christian

    #1282623

    Hi,
    Thank you, this script has been adjusted:

    function savvy_custom_mod(){
    ?>
    <script>
    (function($){
      $(window).on('av-height-change', function() {
        $('.av-masonry:not([class*="-gallery"]) .av-masonry-entry').each(function() {
          var more = $(this).find('.av-masonry-read-more');
          var cont = $(this).find('.av-masonry-entry-content');
      
          if( more.length == 1 ) return;
          cont.append('<div class="av-masonry-read-more">Read more</div>');
        });
      });
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'savvy_custom_mod');

    Please ensure to clear your browser and any caching plugins before checking.

    Best regards,
    Mike

    #1282850

    OK, thanks…now it works only for the Blogpost-masonry like i wished.
    Thanks.

    Back to “the overlapping”
    In your screenshot the elements are “seamless” and they have no margin anyway.
    In my settings for the elements i have choosen “Big margins” :
    [av_masonry_entries link='category,297' wc_prod_visible='' prod_order_by='' prod_order='' sort='no' items='-1' columns='3' paginate='load_more' query_orderby='date' query_order='DESC' size='flex' orientation='' gap='large' overlay_fx='' animation='active' id='' caption_elements='title excerpt' caption_styling='' caption_display='always' color='' custom_bg='' av-medium-columns='' av-small-columns='1' av-mini-columns='1' av_uid='av-mvl8fe' custom_class='']
    And now the margin-bottom shrinks in the moment when the script finished loading:
    douglas-consulting.de/screenshots/masonry.jpg
    douglas-consulting.de/screenshots/masonry2.jpg

    Yes, i do have custom CSS but it just puts a border and even if i remove the custom CSS the effect is the same:
    Big gap before loading the button……no gap on the bottom after loading

    Is this the proper class?
    . av-masonry-entry isotope-item {}

    This is the class i used up to now for styling the masonry element and it worked so far, but even when i delete it, the margin issue is still there:

    .avia_desktop.avia_transform3d .av-masonry-entry.av-masonry-item-loaded .av-inner-masonry {
      background: none repeat scroll 0 0 #fff;
      border: 1px solid #ccc;
      padding: 5px;
      box-shadow: 2px 3px 4px #cccccc;
      border-radius: 5px;
      margin-bottom: 15px;}

    Kind regards
    Chris

    #1282861

    And there are more issues with the masonry:
    I see “title & description“…
    – on big screens
    – on small screens
    – on medium screens i see only the title

    The inspector tells me that there is this:
    @media only screen and (min-width: 767px) and (max-width: 989px) {
    .responsive .av-masonry-entry .av-masonry-entry-title+.av-masonry-entry-content{! display:none;}}
    But this is NOT part of my custom CSS, its from here:
    …wp-content/themes/enfold/config-templatebuilder/avia-shortcodes/masonry_entries/masonry_entries.css?ver=5.6.1

    1: Why is Enfold deciding not to show my description instead of leaving it up to me?
    2: How do i fix this?

    #1283051

    Hi,
    I tested the masonry with the large gap and your css, and the issue I see is with your css, for example the padding: 5px; adds the padding like this (the green area):
    2021-02-23_050005.jpg
    as you notice it is displacing the inner-masonry. I would recommend removing this padding.
    The margin-bottom: 15px; is increasing the “large gap”, I don’t believe that you wanted to increase the gap, so I would recommend removing this also (orange area):
    2021-02-23_050505.jpg
    as you can see, when the padding & margin is removed from your css, the issue is resolved:
    2021-02-23_051340.jpg

    Best regards,
    Mike

    #1283264

    The padding is important to get the border-effect i want.
    But anyways i removed padding & margin and it did not change anything regarding the issue we are talking about.
    The margin has, by the way, no effect on the gap.
    I tested it with several amounts of pixels and there was no change

    #1283401

    Hi,
    I’m not sure what you mean, on my localhost when I remove the css there are no issues?
    Anyways this thread is starting to get off-topic, the topic of this thread is adding a “read more” button to the masonry items, and not the gallery. Which I was able to do for you.
    While I would like to assist with your next topic of customizing the style your masonry items, I don’t see how this can effectively be done without seeing your site. I write this because often issues that I see are a result of css designed to target a different element and was not specific enough. This is one reason we typically ask to see the page you are working on, most css customization is not a “one-size-fits-all” situation.
    We should close this thread as solved, and if you decide you would like more help customizing your masonry style and are willing to create a test page that we can work on together, then please open a new thread explaining what you are trying to achieve with a link, a screenshot is always welcome too.

    Best regards,
    Mike

Viewing 17 posts - 1 through 17 (of 17 total)
  • The topic ‘Read more buttin in masonry blogelement’ is closed to new replies.