[Solved] How to change a custom query into a standard loop?

In order to be able to use template tags, you have to do two things after getting your custom select query: You have to declare the global $post variable. You have to call the setup_postdata($post) function to populate the variables. So, my code had to be changed like so: $results = $wpdb->get_results($wp_query->request, OBJECT); global $post; … Read more

[Solved] show only a given level in nav menu

You need to extend Walker_Nav_Menu in such a way that it only outputs, if I understand you, items that are not “zero” depth– top level. class my_extended_walker extends Walker_Nav_Menu { function start_lvl(&$output, $depth, $args ) { if (0 !== $depth) { parent::start_lvl($output, $depth, $args); } } function end_lvl(&$output, $depth, $args) { if (0 !== $depth) … Read more

[Solved] display public excerpt for private post

I’ve not tested this, but you should be able to complete this task by placing the following code in your template above the loop. query_posts( array( ‘post_status’ => array( ‘published’, ‘private’ ) ) ); This should allow for published and private posts to be displayed in that template. 4 solved display public excerpt for private … Read more

[Solved] Insert html after certain amount of posts?

You could use the following and it should do exactly what you want by checking the value of $loop->current_post. <?php $loop = new WP_Query( array( ‘post_type’ => ‘work’,’posts_per_page’ => ‘-1’ ) ); ?> <ul id=”carousel”> <li> <ul class=”inner-items”> <?php while ( $loop->have_posts() ) : $loop->the_post(); ?> <?php if( $loop->current_post && !($loop->current_post % 6) ) : … Read more

[Solved] Restricting users to a specific front end page [closed]

You’d have to add a function during the init action of WP. There you’ll get the current user and check whether they have a specific role assigned to them and redirect to the page when they do. add_action(‘init’, function () { $user = wp_get_current_user(); $role=”your role”; if (in_array($role, $user->roles)) { wp_redirect(‘url’); } }); WordPress Function … Read more