[Resolved] Make div all linkable in element

Home Forums Support [Resolved] Make div all linkable in element

Home Forums Support Make div all linkable in element

Viewing 5 posts - 16 through 20 (of 20 total)
  • Author
    Posts
  • #1598891
    Elvin
    Staff
    Customer Support

    href=”https://wordpress-425633-1630880.cloudwaysapps.com/claude-mckay/”

    This has to be dynamic.

    We can create a shortcode for this:

    function dynamic_category_link_function( $atts ) {
        ob_start();
    
            $page_id = get_queried_object_id();
            $categories = get_the_category( $page_id );
            foreach($categories as $cat){ 
                $cat_ID = $cat->term_id;
                echo get_category_link($cat_ID); 
            }
        
        return ob_get_clean();  
    }
    add_shortcode( 'dynamic_category_link', 'dynamic_category_link_function' );

    And then try changing this:
    <a href="https://wordpress-425633-1630880.cloudwaysapps.com/claude-mckay/" rel="tag">

    To this:
    <a href=[dynamic_category_link] rel="tag">

    #1599299
    William

    Ah that’s brilliant thank you! Works a treat! Is there a way to make the whole div element clickable?

    #1604239
    Elvin
    Staff
    Customer Support

    Sorry for the delay in response.

    I believe this particular question is directly related to one of your open topics here?
    https://generatepress.com/forums/topic/custom-field-color-to-change-element-background/page/3/#post-1599292

    It may be best if we answer it there. We’ll make sure it gets addressed.

    #1605684
    William

    Yes, that’s right. I’ll close this then so it can be addressed there.

    #1605708
    Elvin
    Staff
    Customer Support

    Thank you. We’ll make sure it gets addressed.

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