• Resolved piratescott

    (@piratescott)


    Basically I want it so every Pending Review post can generate a div above it through the functions (the reason I want it is because I intend to add a voting system for pending review posts so users can click a + at the top of the page.)

    Which file would I find the layout and functions for that specific post type?

    Or do I need to create a new layout specifically for that post type? If so how?

Viewing 2 replies - 1 through 2 (of 2 total)
  • if it was me, I’d throw it in above the the_content hook directly above the post, within functions.php (or a custom plugin incase I changed the theme),

    add_action('the_content','modify_content',999);
        function modify_content($the_content) {
            if (get_post_status() == 'pending') {
                  $the_content = "<div>vote system here</div>". $the_content;
            }
            return $the_content;
        }
    Thread Starter piratescott

    (@piratescott)

    I’m using a plugin called Post Layout (https://wordpress.org/plugins/post-layout/) which seems to do the trick if I use the get_post_status in it like you already mentioned. But I might try your way instead so I don’t have to rely on a plugin just for the div. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Adding div above the Pending Review post type’ is closed to new replies.