Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1026936

    Hi,

    I use the ALB element for showing posts in a grid, I guess the corresponding file is postslider.php.

    I use this snippet from @Ismael to show the categories:

    How can I switch the post title with the category?

    View post on imgur.com

    My PHP is not so good that I could change this in the file for myself.
    Thanks for helping me out.

    #1027605

    Hey Gitte,

    Thank you for using Enfold.

    You can use this script to move the categories before the post title..

    add_action('wp_footer', 'ava_custom_script_move_blog_info');
    function ava_custom_script_move_blog_info(){
    	?>
    	<script type="text/javascript">
            (function() {
                const posts = document.querySelectorAll('.slide-entry');
                if( posts ) {
                    posts.forEach( post => {
                        const cat = post.querySelector('.blog-categories');
                        const title = post.querySelector('.slide-entry-title');
                        
                        cat.parentNode.insertBefore(title, cat.nextSibling);
                    });
                }
            })();
    	</script>
    	<?php
    }

    Best regards,
    Ismael

    #1027760

    it works perfectly, thanks for your help, appreciate it very much, Ismael.

    #1028079

    Hi Gitte,

    Glad Ismael could help.

    If you need further assistance please let us know.
    Best regards,
    Victoria

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