[Resolved] Query loop layout

Home Forums Support [Resolved] Query loop layout

Home Forums Support Query loop layout

Viewing 8 posts - 16 through 23 (of 23 total)
  • Author
    Posts
  • #2299532
    Niek

    Hi Dave,
    Thanks for your help again!
    I followed all your steps, but it does not seem to replace the placeholder i select

    #2299566
    David
    Staff
    Customer Support

    It won’t in the editor unfortunately – does it work on the front end ?

    #2299569
    Niek

    That it does not work on editor is fine.
    Unfortunately, it also does not work in front end. See private info for link.

    #2299597
    David
    Staff
    Customer Support

    Hmmm… i assume you changed the URL path, in the code, just out of interest can you add the exact code i provided? as on my local dev site it is grabbing the category term.

    #2299603
    Niek

    Ah yea i did change the path.
    The code i have now is:

    function db_category_image( $block_content, $block ) {
        $id = get_the_ID();
        $category = get_the_category( $id );
        $cat_name = $category[0]->cat_name;
        if ( ! empty( $block['attrs']['className'] ) && 'cat-image' === $block['attrs']['className'] ) {
            $block_content = '
    		<figure class="gb-block-image has-cat-image">
    		<img class="cat-image" src="images/category/'.$cd->cat_name.'.webp" height="60" width="100" />
    		</figure>
    		';
        } 
        return $block_content;
    }
    #2299632
    David
    Staff
    Customer Support

    Whats the $cd variable for ?
    ie. seen here ?

    <img class="cat-image" src="images/category/'.$cd->cat_name.'.webp" height="60" width="100" />

    #2299689
    Niek

    Ah men, i f’d up.
    I copied the html with from your last code and that had another variable in it.
    I now changed that to the correct $cat_name and it’s working.

    Thank you so much! You guys are legends!

    #2299693
    David
    Staff
    Customer Support

    Awesome – glad to hear thats working 🙂

Viewing 8 posts - 16 through 23 (of 23 total)
  • You must be logged in to reply to this topic.