php - Add class to single based on the order poistion of posts in Wordpress -
i'm trying create simple system number of posts fixed order of posts can dynamically changed user. "post x" can first in order can later last.
inside admin made simple change order in admin drag , drop.
is possible output class based on position order of post? instance: .order-position-1, .order-position-2 etc. know how echo class inside body.
$extrabodyclasses = array(); if ( is_singular( 'post' ) ) { array_push($extrabodyclasses, "theclassname"); } echo body_class($extrabodyclasses);
how can echo "order postion" of post inside class?
okay, **'ing simple.
get_post_field( 'menu_order', $post_id);
Comments
Post a Comment