Posts and order

What you are looking for is page-attributes support in the post type. However… ‘page-attributes’ (template and menu order) (hierarchical must be true) (the page template selector is only available for the page post type) … and posts are not hierarchical. I am not sure you can force them to be, never mind the potential issues … Read more

WP_Query orderby random do not repeat infinite scroll – one loop

I use this solution in my functions.php /*—— order ——*/ session_start(); add_filter(‘posts_orderby’, ‘edit_posts_orderby’); function edit_posts_orderby($orderby_statement) { $seed = $_SESSION[“sem”]; if (empty($seed)) { $seed = rand(); $_SESSION[“sem”] = $seed; } $orderby_statement=”RAND(“.$seed.’)’; return $orderby_statement; } And additionaly, in the page where you show the posts, in the top of the file, i reset the session variable to … Read more

Yet another get_posts() in explicitly defined order problem

Instead, you should use WP_Query Something like so: $specific_order_pages_query_args = array( ‘post_type’ => ‘page’, ‘post__in’ => $ids, ‘orderby’ => ‘post__in’ ); $specific_order_pages_query = new WP_Query( $specific_order_pages_query_args ); WP_Query’s order value post__in is a special value to order by the supplied post__in ID’s See more under Order in WP_Query http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters

Order by ASC, DESC, Title, Date from URL on custom page template post

When you run an additional query, WordPress isn’t going to automagically parse get vars, that only works for the main query. You have to fetch and add them manually. Also, don’t use query_posts, use WP_Query instead. $args = array( ‘category_name’ => $tutcatname, ‘posts_per_page’ => 25, ); if( isset( $_GET[‘order’] ) ){ $args[‘order’] = $_GET[‘order’]; } … Read more

Sort appearence order in the_content()

You could try to add the Facebook-Like html code via this filter: /** * Append Facebook Like to the content * * @param string $content * @return string $content */ function custom_the_content( $content ) { $fblike=”<div class=”fb-like” data-layout=”button_count” data-action=”like” data-show-faces=”false” data-share=”false”> </div>”; return $content . $fblike; } add_filter( ‘the_content’, ‘custom_the_content’, 9, 1 ); if the … Read more

Randomly select one of last 3 posts

$args=array( ‘orderby’ => ‘rand’, ‘order’ => ‘DESC’, ‘posts_per_page’ => 3, ‘offset’ => $offset, ); $q = new WP_Query($args); if($q->post_count>0){ $random_post = $q->posts[mt_rand(0,2)]; } also, just a little note, ORDER BY RAND() is pretty bad for performance

Order terms by count – missing terms

By default hide_empty is true for get_terms. So i guess you must be missing terms which do not have posts. Try this, <?php $terms = get_terms(“autorzy”, array(‘orderby’ => ‘count’, ‘order’ => ‘DESC’,’hide_empty’=>0 )); $count = count($terms); if ( $count > 0 ){ echo “<div>”; foreach ( $terms as $term ) { ?> <?php echo $term->name; … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)