• Resolved jasonsweb

    (@jasonsweb)


    Hi,

    I’ve read the WordPress codex and Googled for hours, but I can’t get the “get_post_class” to work in my shortcode.

    I would like to convert this code into a shortcode valid code:
    <div id="post-1027" <?php post_class('custom-class'); ?>>

    At the moment I have this:
    <div id="post-1027" ' . get_post_class('custom-class', $post->ID) . '>

    But unfortunately this returns an empty class, instead of the complete post classes.

    What am I doing wrong here?
    Thanks in advance!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘get_post_class’ is closed to new replies.