• Resolved logft2043

    (@logft2043)


    Hello, I can’t customize the shortcodes as I want.
    I have 3 elements displayed: image, title and category
    Is it possible to include post_title and post_cat in a common div?
    Currently I get each of these elements in a separate div and I would like them to belong to the same one (without including the image)

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor zymeth25

    (@zymeth25)

    You can do it in a custom template.

    Thread Starter logft2043

    (@logft2043)

    Hi @zymeth25 thanks for the answer

    I found the default.php file and made a copy in my theme folder.

    //Show the title and link to the post:
      $lcp_display_output .= $this->get_post_title($post);
    
      // Show categories
      $lcp_display_output .= $this->get_posts_cats($post);

    I guess I need to make the HTML structure change here but I’m not sure how to do that. Can you direct me to display these 2 elements in a common div?

    I thank you in advance

    Plugin Contributor zymeth25

    (@zymeth25)

    Many ways to do it but the simplest one would be:

    
    //Show the title and link to the post:
    $lcp_display_output .= '<div>' . $this->get_post_title($post);
    
    // Show categories
    $lcp_display_output .= $this->get_posts_cats($post) . '</div>';
    

    You can expand this solution by adding attributes to the div, like class etc.

    Thread Starter logft2043

    (@logft2043)

    It worked, thank you very much!

    But I can’t assign 2 css classes in the shortcode, is it possible? Or do you have to separate them with a special character?

    Example: [… posts_cats_class=”testcat entry-taxonomies” …]

    In front, the 2 classes are pasted and therefore unusable

    Plugin Contributor zymeth25

    (@zymeth25)

    I have just tested it, when I tried [catlist posts_cats=yes posts_cats_class="test1 test2"] i got <span class="test1test2"> Gallery, Images, Jetpack</span>

    which is clearly not what I intended. I will try to look into it today and push an update.

    Plugin Contributor zymeth25

    (@zymeth25)

    Done, fixed in v0.86.1, multiple CSS classes work as expected. Use single whitespace as delimiter like in HTML.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘target multiple css elements’ is closed to new replies.