Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #1270201

    Hello there,

    I’m looking to have my portfolio grid open up on a specific category (Radiographic Systems) so it only shows that category instead of opening up on all.

    I tried to input the coding into the .PHP but it didn’t seem to make a change.

    I have posted the page I’m talking about in private content.

    #1270798

    Hey RMcKee,

    Thank you for the inquiry.

    The following script should activate the Radiographic Systems category sort item on page load. Please add the snippet in the functions.php file

    // activate a specific category sort item
    function ava_activate_sort_button() {
        if ( wp_script_is( 'avia-default', 'registered' ) ) {
            wp_add_inline_script( 'avia-default', '(function($) {
    				$(document).ready( function() {
    					$(".radiographic-systems_sort_button").trigger("click");
    				});
    			})(jQuery);
    	');
        }
     }
     add_action( 'wp_enqueue_scripts', 'ava_activate_sort_button', 9999);
    

    Best regards,
    Ismael

    #1270897

    Hello there,
    I added this into the functions.php but it did not activate Radiographic Systems on page load.

    I don’t believe there were any changes on the page.

    Thank you in advance,
    Rob

    #1271440

    Hi,

    Thank you for the info.

    We noticed that there is a minor syntax error in the above code, so we removed it. Sorry about that. Please try the snippet again or post the login details in the private field so that we could test the script properly.

    Best regards,
    Ismael

    #1278756

    Hi,

    I have a similar request but have two different portfolio grids and like to activate in each portfolio grid a different category?
    I tried to solve this by your advices to have the first category activated but with Safari and Firefox the activated category is not active if you clicked to an other page and returned.

    Best regards,
    Vera

    #1279030

    Hi,

    @vera: You may need to apply a custom css class name or ID to each Portfolio Grid element and use it to toggle the appropriate sorting button of each element accordingly. The class and ID field is in the Advanced > Developer Settings toggle of the Portfolio Grid element.

    // https://kriesi.at/documentation/enfold/add-custom-css/#enable-custom-css-class-name-support

    If you use portfolio-1 and portfolio-2 in the class name field of the two portfolio grid elements respectively, the changes may look something like this.

    $(".portfolio-1 .radiographic-systems_sort_button").trigger("click"); // activate radiographic-systems category for the portfolio grid 1
    $(".portfolio-2 .other-systems_sort_button").trigger("click"); // activate other-systems category for the portfolio grid 2
    

    Best regards,
    Ismael

    #1279101

    Hi Ismael,
    thank you for your reply. As you suggested I created two different CSS-classes (.portfolio-arch and .portfolio-aus) and added the script like this to the functions.php of my child theme. But it has no effect. Do I have to do something additional?
    Best regards,
    Vera

    //------------------------------
    // activate a specific category sort item
    //------------------------------
    function ava_activate_sort_button() {
        if ( wp_script_is( 'avia-default', 'registered' ) ) {
            wp_add_inline_script( 'avia-default', '(function($) {
    				$(document).ready( function() {
    					$(".portfolio-arch .praesentationsmodelle-modellbau-architektur_sort_button").trigger("click"); 
    $(".portfolio-aus .auswahl-anschauungsmodelle_sort_button").trigger("click"); 
    				});
    			})(jQuery);
    	');
        }
     }
     add_action( 'wp_enqueue_scripts', 'ava_activate_sort_button', 9999);
    
    #1279410

    Hi,

    Thank you for the update.

    That looks about right except for the converted quotation marks. You may need to correct it for the scripts to work properly.

    Best regards,
    Ismael

    #1280115

    Hi Isamel,
    thanks for the correction of the quotes. Still it’s not working. Do you have any further suggestion? Perhaps this is already too advanced for me as a non-programmer? An alternative solution would be what the “documentation > portfolio grid > Load a default portfolio category” recommends to show a specific category. This works fine but is not active anymore when you “reenter“ a page after skipping through the navigation under Firefox and Safari. Only under Chrome it’s always active. Thanks again for your help.

    Best regards,
    Vera

    #1280549

    Hi,

    Thank you for following up.

    Would you mind providing access to the WP dashboard and/or the file server? We will try to implement the changes above and add the script in the functions.php file. Please post the login info in the private field.

    Best regards,
    Ismael

    #1280587

    Hi Ismael,

    thanks for your reply. Here are the requested infos.

    Best regards,
    Vera

    #1281333

    Hi,

    Thank you for the info.

    We adjusted the script in the functions.php file a bit so that it actually looks for the sort container and the appropriate category button. It seems to be working properly now. (see private field)

    This is the updated script.

    
    // activate a specific category sort item
    function ava_activate_sort_button() {
        if ( wp_script_is( 'avia-default', 'registered' ) ) {
            wp_add_inline_script( 'avia-default', '(function($) {
    				$(document).ready(function() {
    					$(".portfolio-arch").prev().find(".praesentationsmodelle-modellbau-architektur_sort_button").trigger("click");
    					$(".portfolio-aus").prev().find(".auswahl-anschauungsmodelle_sort_button").trigger("click");
    				});
    			})(jQuery);
    	');
        }
     }
     add_action( 'wp_enqueue_scripts', 'ava_activate_sort_button', 9999);
    

    Best regards,
    Ismael

    #1281347

    Hi Ismael,
    great! Thank you very much for the adjustments. Now it works perfectly.
    Best regards,
    Vera

    #1281925

    Hi Vera,

    Great, I’m glad that Ismael could help you out :-)

    Best regards,
    Rikard

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