Tagged: 

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #746250

    I have the magazine view to show my portfolio items filtered by tag. Some tags will have no items if there are no available products at the time. I would like there to be a message that automatically says “None available at this time” or something to that effect.

    I am wondering if there is something I can add to my child theme functions.php file or my child theme/shortcodes/magazine.php file to make a message appear when there are no items to display.

    Abbi

    #748289

    Hi abbivsaesong!

    Thank you for using Enfold.

    Could you please provide a link to the page with the magazine element? Empty categories should not be included in the magazine tabs by default.

    Cheers!
    Ismael

    #752718

    If you scroll down on this page, you will see some tabs on the right side. The second tab is pointing to a certain category from my portfolio items. They will be created and removed as houses become available or are sold. Right now, if my client was to create a new portfolio item (home) in the correct category, it would automatically show up in the proper tab. Right now there are a number of homes with no quick possession available at this time. If there is currently no available houses in the chosen model, I would like a message to display saying “none available” rather than showing an empty box.

    This one is set up to display from the category, but as there are no current items, nothing shows up.

    #752754

    Hi!

    Like I said, empty categories will not display in the tab. If you really need this feature, please modify the config-templatebuilder > avia-shortcodes > magazine.php file then look for this code around line 288:

    $sort_terms = get_terms( $this->atts['taxonomy'] , array('hide_empty'=>true) );
    

    .. replace it with:

    $sort_terms = get_terms( $this->atts['taxonomy'] );
    

    This will force the tab to include empty categories.

    Cheers!
    Ismael

    #753380

    Thanks! Would you be able to give me an idea of how to do this using Enfold Child theme?

    Abbi

    #753444

    Hey!

    I’m sorry but you can’t do this modification in a child theme. You have to modify the parent theme files.

    Regards,
    Ismael

    #754832

    Thanks,
    I changed the code, though there doesn’t seem to be any difference. Do you mind taking a look?

    Abbi

    #754849

    Hi!

    Please provide a url or a link to the page with the element. And post the login details so that we can check the categories.

    Cheers!
    Ismael

    #764895

    Please take a look at the page and let me know if there is a way to set up the element! :)

    #767143

    Hi,

    Thank you for the info.

    We added the following script in the functions.php file:

    function ava_custom_script_fix(){
    ?>
    <script>
    (function($){
    	function a() {
    			$('.av-magazine').each(function() {
    					var content = $(this).text();
    					if(content == '') {
    							$(this).text('None available at this time');
    					}
    			});
    	}
    
    	a();
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'ava_custom_script_fix');

    The script will add the “None available at this time” text if the magazine element is empty.

    Best regards,
    Ismael

    #768545

    fantastic! Works like a charm now

    #768577

    Hi,

    Let us know if you have any other questions or issues :)

    Best regards,
    John Torvik

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