Why loop renders only last metabox from array? [closed]

Its because you are assigning your last array element to your class properties post_type,unicname,headline,fieldDisc Since the input is an array you are overriding the class properties again and again, only last array element is saved there(post_type,unicname,headline,fieldDisc). So what I would suggest is either store the whole array in one property or make each property an … Read more

List of authors posts minus very latest

There’s no need for multiple queries – posts are, by default, ordered by most recent. Just apply a classname for the first post on the first page: <article <?php post_class( $wp_query->current_post === 0 && ! is_paged() ? ‘my-awesome-first-post’ : ” ) ?> The first post of the first page will have the class my-awesome-first-post. Update: … Read more

Pagination returns 404 after page 20

What you are experiencing is quite normal and expected. This is one of the big reasons I always hammer on this point, never use custom queries to replace the main query on the home page or any type of archive page. They solve one issue but creates plenty other new ones Lets look at what … Read more

Alternative layout the loop

For those interested, i’ve solved my problem using sizeof($wp-query->posts) The end-result is this content-news.php template <?php //echo sizeof($wp_query->posts); //var_dump($wp_query);die(); if(sizeof($wp_query->posts) == 4) : ?> <?php if( $wp_query->current_post == 0 ) : ?> <h3><?php the_title(); ?></h3> <div class=”row”> <div class=”col-md-12″> <p><?php the_excerpt(); ?></p> <p><a href=”https://wordpress.stackexchange.com/questions/216989/<?php the_permalink(); ?>” class=”btn btn-primary btn-sm”>Lees Meer</a></p> </div> </div> <div class=”fh5co-spacer fh5co-spacer-sm”></div> … Read more

Create a hierarchical loop at predefined markup requirements

I was able to figure it out myself, here is the code: <div id=”fullpage”> <?php //for each category, show 5 posts $cat_args=array( ‘orderby’ => ‘name’, ‘order’ => ‘desc’ ); $categories=get_categories($cat_args); foreach($categories as $category) { $args=array( ‘showposts’ => 5, ‘category__in’ => array($category->term_id), ); $posts=get_posts($args); if ($posts) { echo ‘<section class=”vertical-scrolling” data-anchor=”‘ . $category->name.'”>’; foreach($posts as $post) … Read more

Show Posts By Custom Field

Frankly, this question shouldn’t exist, it has been answered hundreds of times across the web.. Im going to answer the most tricky part – query itself. Everything else is simple HTML and PHP. You can also find examples in link I provided below. If you can’t do PHP and HTML yourself, you shouldn’t ask this … Read more

Modify widget to output posts in custom order

Looking at that code, it doesn’t look like there are any filters that would allow you to do what you’re hoping. This isn’t particularly surprising… Taking a step back, Posts are inherently intended to contain chronologically-ordered content, so it’s unusual for plugins to allow ordering of posts by anything other than their published date. If … Read more

Infinite Loop after Genesis Theme Upgrade

Delete the folder that contains the Genesis theme and you will be able to log into your site. Also – before restoring your theme change your permalinks to standard. That will rewrite your .htaccess file to make sure it works with WordPress. Then, once you reinstall Genesis, you should be able to restore your permalinks … Read more