Tagged: magazine
-
AuthorPosts
-
February 13, 2017 at 9:33 am #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
February 17, 2017 at 9:27 am #748289Hi 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!
IsmaelFebruary 28, 2017 at 2:50 am #752718If 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.
February 28, 2017 at 7:44 am #752754Hi!
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!
IsmaelMarch 1, 2017 at 1:27 am #753380Thanks! Would you be able to give me an idea of how to do this using Enfold Child theme?
Abbi
March 1, 2017 at 6:52 am #753444Hey!
I’m sorry but you can’t do this modification in a child theme. You have to modify the parent theme files.
Regards,
IsmaelMarch 3, 2017 at 6:14 am #754832Thanks,
I changed the code, though there doesn’t seem to be any difference. Do you mind taking a look?Abbi
March 3, 2017 at 7:03 am #754849Hi!
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!
IsmaelMarch 22, 2017 at 5:11 pm #764895Please take a look at the page and let me know if there is a way to set up the element! :)
March 27, 2017 at 3:47 am #767143Hi,
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,
IsmaelMarch 29, 2017 at 3:22 am #768545fantastic! Works like a charm now
March 29, 2017 at 6:17 am #768577Hi,
Let us know if you have any other questions or issues :)
Best regards,
John Torvik -
AuthorPosts
- You must be logged in to reply to this topic.