Forum Replies Created

Viewing 30 posts - 1 through 30 (of 181 total)
  • Author
    Posts
  • in reply to: CPT Sticky Posts in Masonry #1494585

    Sorry!

    in reply to: CPT Sticky Posts in Masonry #1494515

    Hi Ismael,

    thanks for your reply. As I mentioned, I had implemented your new code but it reversed the queries. The order in each query was correct, but the posts with filled ACF field were at the end of the list. No matter how the ACF date was set (j. F Y or Ymd or YYYY-MM-DD). The result is:

    Post A 25.1.
    Post C 18.1.
    Post B 22.1. (ACF)
    Post D 5.2. (ACF)

    The sorting within the queries is correct, but first the posts without a filled field are shown, and then those with a filled ACF field. Why is this the wrong way around? I want it like that:

    Post B 22.1. (ACF)
    Post D 5.2. (ACF)
    Post A 25.1.
    Post C 18.1.

    Will try to give you access.

    Kind regards,
    Daniel

    in reply to: CPT Sticky Posts in Masonry #1494376

    Hi Ismael, just to clarify the problem once again: I have the following code to sort posts in a masonry. There are posts where a ACF date field is filled in (name: termin_datum, date format: j. F Y). These posts should be shown first. In ascending date order, for example, first the post with the value 31.1.2026 in the ACF field, then the post with 5.2.2026 in the corresponding field. After those come the posts where this field is not filled in. These should be sorted in descending order by post date. So the post created on 15.1.2026 would come first, followed by the one created on 20.1.2026. This results in the following structure:

    Posts in the backend:
    Post A from 25.1.26 (ACF field: empty)
    Post B from 22.1.26 (ACF field: 31.1.2026)
    Post C from 20.1.2026 (ACF field: empty)
    Post D from 18.1.2026 (ACF field: 5.2.2026)

    Sorting in the frontend:
    Post B 22.1. (ACF)
    Post D 5.2. (ACF)
    Post A 25.1.
    Post C 18.1

    This is my current code, but it does not meet all criteria:

    if(!function_exists('avia_custom_query_extension'))
    {
        function avia_custom_query_extension($query, $params)
        {
            global $avia_config;
            if(!empty($avia_config['avia_custom_query_options']['order']))
            {
                $query['order'] = $avia_config['avia_custom_query_options']['order'];	
            }
    	        if(!empty($avia_config['avia_custom_query_options']['orderby'])) {
    	        	
    				if($avia_config['avia_custom_query_options']['orderby'] == 'termin_datum') {
    
    				    $query['orderby'] = [
    				        'meta_value' => 'DESC', 
    				        'date'       => 'DESC' 
    				    ];
    					$query['meta_key'] = 'termin_datum';						
    				}				
    				else {				
    	        		$query['orderby'] = $avia_config['avia_custom_query_options']['orderby'];	
    	        	}
    		}
            unset($avia_config['avia_custom_query_options']);
            return $query;		
        }

    Both queries are created correctly, with posts with a filled ACF field coming first, followed by those without. The posts without a filled ACF field are also in the correct order, while those with a filled field are exactly the wrong way around. This results in the following sorting:

    Post D 5.2. (ACF)
    Post B 22.1. (ACF)
    Post A 25.1.
    Post C 18.1.

    The first posts are therefore in the wrong order. The sorting should look like this:

    Post B 22.1. (ACF)
    Post D 5.2. (ACF)
    Post A 25.1.
    Post C 18.1.

    I set the time format to YYYY-MM-DD and I tried your code. No success. The result ist always:

    Post A 25.1.
    Post C 18.1.
    Post B 22.1. (ACF)
    Post D 5.2. (ACF)

    The sorting within the queries is correct, but first the posts without a filled field are shown, and then those with a filled ACF field. Why is this the wrong way around? I want it like that:

    Post B 22.1. (ACF)
    Post D 5.2. (ACF)
    Post A 25.1.
    Post C 18.1.

    Is one of the following filters in the code from the documentation causiung the issue? Any idea on how to solve the problem? Thanks in advance!

    All the best,
    Daniel

    in reply to: CPT Sticky Posts in Masonry #1494071

    Hi Isamel, it is the same wrong sorting behaviour with the date field in Ymd or Y-m-d (testet both ways). Any other ideas?

    Hi Guenni, I will try to find the time to do a test for you but it will not be a solution for my wrong ordering at the moment …

    in reply to: CPT Sticky Posts in Masonry #1493963

    Hi Guenni, thank you for the code but as mentioned in post #149384 I stepped away from a solution with sticky posts because it is cleaner for me to sort by ACF field first and sort the other posts later. In this sorting is an error as explained above (#1493913) and I dont know why the order is the wrong way around. Do you have an idea?

    in reply to: CPT Sticky Posts in Masonry #1493913

    Hi Ismael, same problem the sorting ist correct but the posts with the filled ACF field are at the end. I want them to be shown before the posts without the filled field. Any idea on how to keep the array in the first place?

    in reply to: CPT Sticky Posts in Masonry #1493848

    Hi Guenni, thanks for asking. It was not working as expected, therefore I tried a different solution. I added a date field with ACF termin_datum and want to sort all posts by this field. The posts without the field shall be sorted by the date of the post itself. I inserted this code from the documentation:

    if(!function_exists('avia_custom_query_extension'))
    {
        function avia_custom_query_extension($query, $params)
        {
            global $avia_config;
            if(!empty($avia_config['avia_custom_query_options']['order']))
            {
                $query['order'] = $avia_config['avia_custom_query_options']['order'];
    			
            }
    
    	        if(!empty($avia_config['avia_custom_query_options']['orderby'])) {
    	        	
    				if($avia_config['avia_custom_query_options']['orderby'] == 'termin_datum') {
    
    				    $query['orderby'] = [
    				        'meta_value' => 'DESC', // Sorting posts by ACF date in ascending order
    				        'date'       => 'DESC' // Fallback for posts without a date; these should come last
    				    ];
    				
    					// Define ACF field
    					$query['meta_key'] = 'termin_datum';	
    					
    				}
    				
    				else {
    				
    	        		$query['orderby'] = $avia_config['avia_custom_query_options']['orderby'];	
    	        	}
    		}
    
            unset($avia_config['avia_custom_query_options']);
    
            return $query;
    		
        }
    
        add_filter('avia_masonry_entries_query', 'avia_custom_query_extension', 10, 2);
        add_filter('avia_post_grid_query', 'avia_custom_query_extension', 10, 2);
        add_filter('avia_post_slide_query', 'avia_custom_query_extension', 10, 2);
        add_filter('avia_blog_post_query', 'avia_custom_query_extension', 10, 2);
        add_filter('avf_magazine_entries_query', 'avia_custom_query_extension', 10, 2);
    
        add_filter('avf_template_builder_shortcode_elements','avia_custom_query_options', 10, 1);
        function avia_custom_query_options($elements)
        {
            $allowed_elements = array('av_blog','av_masonry_entries','av_postslider','av_portfolio','av_magazine');
    
            if(isset($_POST['params']['allowed']) && in_array($_POST['params']['allowed'], $allowed_elements))
            {
                $elements[] = array(
                    "name" => __("Custom Query Orderby",'avia_framework' ),
                    "desc" => __("Set a custom query orderby value",'avia_framework' ),
                    "id"   => "orderby",
                    "type" 	=> "select",
                    "std" 	=> "",
                    "subtype" => array(
                        __('Default Order',  'avia_framework' ) =>'',
                        __('Title',  'avia_framework' ) =>'title',
                        __('Random',  'avia_framework' ) =>'rand',
                        __('Date',  'avia_framework' ) =>'date',
                        __('Author',  'avia_framework' ) =>'author',
                        __('Name (Post Slug)',  'avia_framework' ) =>'name',
    		    __('Datum (ACF)',  'avia_framework' ) =>'termin_datum',
                        __('Modified',  'avia_framework' ) =>'modified',
                        __('Comment Count',  'avia_framework' ) =>'comment_count',
    		    __('Page Order',  'avia_framework' ) =>'menu_order')
                );
    
                $elements[] = array(
                    "name" => __("Custom Query Order",'avia_framework' ),
                    "desc" => __("Set a custom query order",'avia_framework' ),
                    "id"   => "order",
                    "type" 	=> "select",
                    "std" 	=> "",
                    "subtype" => array(
                        __('Default Order',  'avia_framework' ) =>'',
                        __('Ascending Order',  'avia_framework' ) =>'ASC',
                        __('Descending Order',  'avia_framework' ) =>'DESC'));
            }
    
            return $elements;
        }
    
        add_filter('avf_template_builder_shortcode_meta', 'avia_custom_query_add_query_params_to_config', 10, 4);
        function avia_custom_query_add_query_params_to_config($meta, $atts, $content, $shortcodename)
        {
            global $avia_config;
            if(empty($avia_config['avia_custom_query_options'])) $avia_config['avia_custom_query_options'] = array();
    
            if(!empty($atts['order']))
            {
                $avia_config['avia_custom_query_options']['order'] = $atts['order'];
            }
    
            if(!empty($atts['orderby']))
            {
                $avia_config['avia_custom_query_options']['orderby'] = $atts['orderby'];
            }
    
            return $meta;
        }
    }

    That works as expected, there is only one problem: The sorting order is wrong! Now it is shown this way in frontend:

    7.2. (with filled ACF date fieldF)
    31.1. (with filled ACF date field)
    11.1. (with filled ACF date field)

    And after that the posts without the date field in correct order by publishing date:

    2.1. (without ACF by publishing date)
    30.12. (without ACF by publishing date)
    24.12. (without ACF by publishing date)

    But I want it sorted like that:

    11.1. (with filled ACF date field)
    31.1. (with filled ACF date field)
    7.2. (with filled ACF date field)
    2.1. (without ACF by publishing date)
    30.12. (without ACF by publishing date)
    24.12. (without ACF by publishing date)

    If I try altering the ASC / DESC settings, the posts with ACF are shown after the posts without the filled acf field. Any ideas on why it is like that?

    Thanks in advance and all the best wishes for 2026!

    in reply to: CPT Sticky Posts in Masonry #1492405

    Yes: angebot

    in reply to: CPT Sticky Posts in Masonry #1492400

    Hi Ismael, I always tried one at a time:

    Code from my opening post: Only sticky post is shown
    Code from your post: Only sticky post is shown
    Code from Guenni: Only non sticky posts are shown

    in reply to: CPT Sticky Posts in Masonry #1492388

    Hi Guenni, I used the code of Ismael. Result: Only the sticky post is shown. If I use your code only the non sticky posts are shown. I want the sticky posts to be shown first and the non sticky afterwards. As it is in the blog with normal posts.

    in reply to: CPT Sticky Posts in Masonry #1492339

    Hi Ismael,

    I found this code already but the problem remains: Now my sticky posts from a CPT show up at the top –> BUT the rest of the posts is missing. Only the sticky posts are in the query, the remaining posts are not part of the masonry. I have one sticky post and without the code all posts are shown. With the code only the sticky one is visible. Same behaviour as with the code from my question …

    Kind regards,
    Daniel

    in reply to: Wrong language in ‘Product Meta Info’ #1491795

    Hi Yigit, that is exactly what I am waiting for (see post #1491131). Thank you! Do you think the update with the translation will be rolled out until the end of the year or even sooner?

    in reply to: Wrong language in ‘Product Meta Info’ #1491756

    Hi Yigit, that is exactly what I tried on one installation with LocoTranslate installed but it did not work. Now I tried it again and the translation is correct. No clue why but thanks!

    The error in the installation without LocoTranslate persists. It was correctly translated in the last version.

    in reply to: Wrong language in ‘Product Meta Info’ #1491745

    Hi Yigit, on November 10 we already sorted the issue. Now I am just waiting for the next update (see posts of Rikard).

    in reply to: Wrong language in ‘Product Meta Info’ #1491738

    Hi Rikard,

    do you think the update with the fix will be rolled out until the end of the year or even sooner?

    Kind regards,
    Daniel

    in reply to: Wrong language in ‘Product Meta Info’ #1491111

    Hi! I’m glad to hear that. How long do you think it will take for the fix to be released? And it would be great if the problem would not reappear. As I said, this is now the second time it has happened in exactly the same place. As far as I know.

    in reply to: Wrong language in ‘Product Meta Info’ #1491098

    Hi Rikard,

    Thanks for your feedback. I currently have this problem on two different pages. I have updated both to the latest versions of everything. One has ‘Loco Translate’ installed, the other does not. Both show the word “Categories:” in English in the element, not in German (as discribed in my initial post). So it can’t be the multi lingual plugin. As I said, there was a similar error in the past, where the string in the theme could not be translated …

    Any idea on how to solve that?

    Kind regards,
    Daniel

    in reply to: Logo as SVG #1486391

    Yes. That’s very interesting. Never stumbled over this part of layout.css even with some fixed and transparent headers for mobile on various homepages. Therefore the code in functions.php is correct and the logo is loaded as SVG file but by CSS the normal version is shown on smaller screens. Sorted the CSS and now everything is as expected.

    Thanks to all helping hands for bringing light into the darkness!

    in reply to: Logo as SVG #1486305

    Hi! In my testing I deactivated the code and as I already mentioned the path versions are loaded correctly if the code is inactive. White an all screen sizes.

    With the active code in functions.php there is only the white one on large screens (the one defined for transpareny mode) and the blue one (normal logo) on screen sizes below 990px. Activated the code and you can see the behaviour online.

    Maybe you can check CSS because what’s interesting: I don’t have the lines mentioned from Guenni007 in my layout.css. See our posts above.

    Thanks in advance!

    Kind regards,
    Daniel

    in reply to: Logo as SVG #1486279

    Thank you for giving it a try. Very interesting. In my installations there is the following CSS:

    @media only screen and (max-width: 989px) {
      .responsive.html_mobile_menu_tablet #top .av_header_transparency.av_alternate_logo_active .logo a > img, .responsive.html_mobile_menu_tablet #top .av_header_transparency.av_alternate_logo_active .logo a > svg {
        opacity: 1;
      }
    }
    @media only screen and (max-width: 989px) {
      .responsive.html_mobile_menu_tablet #top .av_header_transparency .logo img.alternate, .responsive.html_mobile_menu_tablet #top .av_header_transparency .logo .subtext.avia-svg-logo-sub {
        display: none;
      }
    }

    Don’t know where it comes from. The first shows the normal logo, the second hides the alternate version below 990px. That’s exactly the error.

    In your installation it is like that:

    #top .av_header_transparency.av_alternate_logo_active .logo a > img, #top .av_header_transparency.av_alternate_logo_active .logo a > svg {
      opacity: 0;
    }
    
    .av_header_transparency .logo img.alternate, .av_header_transparency .logo .subtext.avia-svg-logo-sub svg {
      opacity: 1;
    }

    No query whatsoever. But the CSS above is not from me. It has to be from Enfold.

    Your test is: Logo in backend, alternate logo in backend, code from above in functions, page set to “transparent header” – correct?

    in reply to: Logo as SVG #1486267

    I built that code with Ismael in an other thread. Works on multiple installations for me. All with Enfold 7.1.1. In the theme settings I put the logos as SVG files and those files are loaded in the frontend. As it used to be in older Enfold versions.

    Now I double checked the avia-snippet-sticky-header.js and see it just as you described: only styling of the header, no tweaking of the logo

    On an other installation I tried the code and it is working as expected, but same behaviour on mobile: the normal logo is loaded, not the one defined in the transparency settings.

    I believe it is because usually the header isn’t transparent on mobile. Even with header set to transparent in backend it is only transparent for the larger screen sizes. On mobile the header is normal and therefore the normal logo is loaded and used instead of the one from the transparency settings.

    My conclusion is that I will have to sort it out with CSS since both logos are available in the code.

    But what’s interesting: If I use the SVGs as path (without the code mentioned above) the version from the transparency settings is used on mobile too. That’s different to older Enfold versions and to the behaviour with a logo as image file. Or am I wrong?

    in reply to: Logo as SVG #1486246

    I basically agree with you. But that means having the appropriate files, editing them if necessary and in addition writing CSS rules for the display in the transparent header. That’s a lot of work (if you’re responsible for a lot of homepages) and that is why I like to continue working with SVGs as linked files. This also makes exchange of a logo easier. In my opinion.

    Unfortunately my question has still not been answered: Is it defined somewhere in avia-sticky-header.js which logo file is loaded for the transparent header? Is there a difference with regard to mobile screens? If so, I would have to take another look at the file and make the necessary adjustments.

    in reply to: Logo as SVG #1486206

    In avia-sticky-header.js?

    in reply to: Logo as SVG #1486204

    That is correct. But sometimes SVGs are quite complex in structure and for those cases I use the code above to load them as a file rather than the path. I can sort it out with CSS, no problem. But I dont’t understand the behaviour right now. Is anything in avia-sticky-header.js relevant for loading the logo from the theme’s transparency settings on mobile?

    in reply to: Logo as SVG #1486196

    Hi :-) The svg is loaded as image!

    function avf_no_inline_svg_mod($attachment_id, $url) {
        $logo_url = avia_get_option( 'logo' );
    	$logo_url_transparency = avia_get_option( 'header_replacement_logo' );
    
        if ($url && $url == $logo_url || $url && $url == $logo_url_transparency) {
            return true;
        }
    
        return false;
    }
    add_filter('avf_no_inline_svg', 'avf_no_inline_svg_mod', 10, 2);

    That works as expected on larger screens. But not on mobile. If the header is fixed and shrinking on mobile too. That’s why I changed the avia-sticky-header.js with a code from you, found in the forum.

    in reply to: Logo as SVG #1486191

    Hi Mike, as I said: It is not about the small round one. Everything finde with that. And it is not about a transparent background either. The logo in the header is different for the mobile versions and the desktop version. For the desktop version (above 990px) the logo is white (as defined in the theme’s transparency settings) and for the mobile/smaller versions it is blue – that is the normal logo, not the one defined in the theme’s transparency settings. Now my question is: Why? Is anything of the transparency logic defined in avia-sticky-header.js? Than this could be the reason, because I altered the avia-sticky-header.js

    in reply to: Logo as SVG #1486142

    Hi Mike,

    it is about the logo that changes in header before scroll. After scroll everything is fine. Before scroll there is a white logo (the one defined for transpareny mode) shown on large screen sizes (white). On smaller screens the transparency mode logo is overruled by the normal one (blue).

    I think I can sort it out with css but am curious if there is an error in the filter (see above) or is it because of the altered avia-sticky-header.js.

    All the best,
    Daniel

    in reply to: Logo as SVG #1486010

    No, I did not remove it. Just go below 990px width. Than the alternate logo part is hidden by display: none.

    The longer I think about it I think the problem isn’t the filter. It is because of the changes in avia-sticky-header.js and that those aren’t reflecting the two different logo types …

    in reply to: Logo as SVG #1485991

    Hi Ismael,

    on an other page I have the header on mobile sticky and transparent too (avia-sticky-header.js). See link.

    in reply to: Show caption in iframe lightbox #1484762

    Hi Ismael,

    I tried to add the gallery function like that:

    (function($){
    $(document).ready(function() {
    $('.test').magnificPopup({
      type: 'iframe',
      gallery: { enabled: true },
      iframe: {
         markup: '<div class="mfp-iframe-scaler">'+
                    '<div class="mfp-close"></div>'+
                    '<iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe>'+
                    '<div class="mfp-title">Some caption</div>'+
                  '</div>'
      },
      callbacks: {
        markupParse: function(template, values, item) {
         values.title = item.el.attr('title');
        }
      }
      
    });
    });
    })(jQuery);

    And it works! Images and videos mixed in a lightbox gallery as iframes with titles below each entry. Only the arrows look different to the usual ones from the lightbox, but I can sort that out with CSS I think.

    Thank you for helping me out!

    All the best,
    Daniel

Viewing 30 posts - 1 through 30 (of 181 total)