-
AuthorPosts
-
December 17, 2022 at 3:39 pm #1376468
Dear support,
i try to add a read-more Button to the portfolio raster element with this code in the child themes function.php
But i do not see any buttons – is this solution not working anymore?add_filter('avf_portfolio_title', function($title) { return $title . "<span class='readmore'>Weitere Informationen</span>"; }, 10, 1);
Thanks for any help!
December 18, 2022 at 10:15 pm #1376618Hey dondela,
Thanks for the link to your site, I see the read more button text in your grid so I guess you want to style it. While I’m not sure how you want to style the button I make these changes to give you an idea.
First I added the button class to your readmore code above like this:add_filter('avf_portfolio_title', function($title) { return $title . "<span class='avia-button readmore'>Weitere Informationen</span>"; }, 10, 1);
and then I added this css to your child theme stylesheet:
#top .avia-button.readmore { display: block; background-color: #164E86; color: #fff; }
Please see the screenshot in the Private Content area.
I saw that your child theme was broken because it was missing the Template header in the stylesheet:
I fixed this for you.Best regards,
MikeDecember 19, 2022 at 11:13 am #1376678Hey Mike,
thank you so much for your help, awesome support!I have two more questions to this topic:
1. Would it be possible to place the button underneath the excerpt at the very bottom of the portfolio, like in the screenshot?
2. And is there a way to force all grids to have the same height?Best regards
DondelaDecember 19, 2022 at 8:45 pm #1376787Hi,
Thanks for the screenshot and the feedback, first I added this function to your child theme functions.php to make all of the portfolio title & excerpt containers the same height since some of them had more text than others.function equal_height_portfolio_grid_title_excerpt_container() { ?> <script> window.addEventListener('DOMContentLoaded', function() { (function($){ $('#top.page-id-48556 #av-sc-portfolio-1 .grid-sort-container').each(function(){ var $columns = $('.grid-content',this); var maxHeight = Math.max.apply(Math, $columns.map(function(){ return $(this).height(); }).get()); $columns.height(maxHeight); }); })(jQuery); }); </script> <?php } add_action('wp_footer', 'equal_height_portfolio_grid_title_excerpt_container');
To make the button square and orange I changed the css to this:
#top .avia-button.readmore { display: table; background-color: #FF8D00; color: #fff; bottom: 10px; position: absolute; }
and then to place the portfolio button after the excerpt I added this to your child theme functions.php
function portfolio_grid_button_after_excerpt() { ?> <script> (function($){ $( '#top.page-id-48556 #av-sc-portfolio-1 .grid-entry' ).each(function() { $( this ).find( '.avia-button.readmore' ).insertAfter( $(this).find('.grid-entry-excerpt')); }); })(jQuery); </script> <?php } add_action('wp_footer', 'portfolio_grid_button_after_excerpt');
Please clear your browser cache and check and see the screenshot in the Private Content area.
Best regards,
MikeDecember 20, 2022 at 9:52 am #1376833Hi Mike,
wow, thanks for your help again!It seems this solution is just for the page-id-48556 and the buttons do not have hyperlinks to the page anymore?
I included different portfolio-grids on different pages, i postet an example in private section. There you see the grid at the bottom of the page.I am not sure how i should change your code to make it work?
Best regards
DondelaDecember 20, 2022 at 2:37 pm #1376889Hi,
Thanks for your feedback, I see that moving the button moved it out of the linked area, so I removed the last code snippet and now the button is linked and the previous css still shows the button at the bottom.
So yes this was for the one page, I removed this limitation, please clear your browser cache and check.Best regards,
MikeDecember 20, 2022 at 9:44 pm #1376934Hi Mike,
awesome!
Now it works almost on all pages except the one on this page. (Private section)
Is there a way to give the height of the boxes a little extra pixels?
Thanks you so much for your effort!!Best regards
dondelaDecember 21, 2022 at 1:47 am #1376945Hi,
Thanks for the feedback that page didn’t use the same settings as the other pages, since you want it to work on all pages all of the elements will need to use the same settings.
To add more height I added this css:#av-sc-portfolio-1 .grid-content { min-height: 220px; }
This might seem like a lot of space on some pages, but on other pages when the elements have more content it is just right, please see the screenshot in the Private Content area.
Best regards,
MikeJanuary 5, 2023 at 1:54 pm #1377705Dear Mike,
i have one more question regarding the portfolio masonry: By default, all selected categories are displayed. Is there a possibility to exclude the currently displayed page from this list?
Thanks for any help!January 6, 2023 at 2:13 am #1377780Hi,
I added this script to your child theme functions.php to get the portfolio page ID and search the portfolio grid entries for matching items and hide them, I tested it on the two pages linked below.function get_single_portfolio_pageid_and_hide_matching_portfolio_grid_item() { ?> <script> window.addEventListener('DOMContentLoaded', function() { (function($){ if ($('body.single-portfolio')){ $("[class*='postid']").each ( function () { var elClasses = $( this ).attr ( 'class' ).split ( ' ' ); for ( var index in elClasses ) { if ( elClasses[index].match ( /^postid-\d+$/ ) ) { var classNum = elClasses[index].split ( '-' )[1]; break; } } var postentry = ('.post-entry-'+classNum); $('#av-sc-portfolio-1').find(postentry).css({'display':'none'}); }); }else{} })(jQuery); }); </script> <?php } add_action('wp_footer', 'get_single_portfolio_pageid_and_hide_matching_portfolio_grid_item');
Best regards,
MikeJanuary 9, 2023 at 4:36 pm #1378029Dear Mike,
thank you so much for your great support, awesome!I have one more question about the pagination of the portfolio element: When I activate pagination, the buttons for scrolling appear, but when I click on page 2, the webpage scrolls to the top. Does this have something to do with the new javascript? or how can I prevent the scrolling when turning pages?
You can try this at the bottom of the page in private content area.January 9, 2023 at 7:37 pm #1378041 -
AuthorPosts
- You must be logged in to reply to this topic.