Hi!
I am building a site for a travel agency (link in private section) and on certain pages multiple destinations are displayed. The first two words are always the same and I would like to hide these words. Can you help with this? I’ve tried to work with nth-child and other css options but without any luck so far.
Hope you can help!
Hey Daniel,
Thanks for the link, so this is supposed to be conditional? If there are more than one destination those words should be hidden? How do we know if there are more than one destination on the page?
Best regards,
Rikard
Hi Rikard, yes it is conditional. I always use the blog element to display the title, the color section where it’s nested in always has the same custom class (.bestemmingen). Are those enough conditions?
Hi,
Thanks for the feedback. There are no conditionals in CSS, so you would have to use the page-id class to do that manually if you want to hide them using CSS. If you want to use a PHP function then you would need to check if a variable is greater than 1 for instance, is there such a variable?
Best regards,
Rikard
Hi,
Thanks for your reply. I’d very much like to fix this using CSS and since it’s only on six pages where I have to hide these words, that would be a workable solution. How would we do this using the page-id class(es)?
Daniel
Hi,
Thanks for the update.
This script should remove the word “Incentive reis”.
function ava_custom_script_remove_word() {
?>
<script>
(function($) {
$('.slide-entry-title.entry-title a').each( function() {
var text = $(this).text();
var newtext = text.replace(/Incentive reis /g, '');
$(this).text(newtext);
});
})(jQuery);
</script>
<?php
}
add_action( 'wp_footer', 'ava_custom_script_remove_word', 9999 );
Best regards,
Ismael
Hi Ismael,
This works like a charm, thanks!
Hi Daniel,
Glad that Ismael helped you :)
Feel free to comeback if you need further assistance.
Thanks for using Enfold and have a great day!
Best regards,
Nikko