Limit posts per author role (excluding admin) in home page

If I understand your problem then this should definitely work. <?php get_header(); $users = get_users( array( ‘who’ => ‘author’ ) );//get all the users with author role in an array foreach ( $users as $user ) { //travers the array if($user->caps[‘administrator’]==1)continue; // skip the user if user also have administrative capabilities $query = new WP_Query( … Read more

Static page does not show my posts

So this is the code I have on one of my Website inside the footer, this basically get’s the 3 latest posts and displays the_title you can change this to show the_excerpt. <?php // news posts loop begins here $newsPosts = new WP_Query(‘page=blog&posts_per_page=3’); if ($newsPosts->have_posts()) : while ($newsPosts->have_posts()) : $newsPosts->the_post(); ?> <!– Blogs –> <div … Read more

Adding Filter to Homepage only

Even if wrap your filter in a if statement, the function still will be executed. Try this: global $current_class; $current_class=”flex-container”; function rt_oddeven_post_class ( $classes ) { if ( is_home() || is_front_page() ) { global $current_class; $classes[] = $current_class; $current_class = ($current_class == ‘flex-container’) ? ‘flex-container-reverse’ : ‘flex-container’; return $classes; } } add_filter ( ‘post_class’ , … Read more

Add field to dashboard to update embedded URL on homepage?

Add the below code in the functions.php file and it will create a text field in the general setting options page add_action(‘admin_init’, ’embed_url_initialize’); function embed_url_initialize() { // First, we register a section. This is necessary since all future options must belong to one. add_settings_section( ‘general_settings_section’, // ID used to identify this section and with which … Read more

Any action in wordpress redirects me to home page

After Spending many hours on this seemingly insoluble problem, as it turned out the issue was generated from mod security being enabled. Although, I disabled it myself from cpanel, it had to be turned off from server and a level deeper in hosting as well. So if you encountered this knot contact your web host … Read more

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