Repeat code, change variable?

So you basically don’t want to keep repeating the same HTML over and over. You should put all of the tags and categories you want to display into an array. Then iterate over that array, querying and printing HTML each time. You could use conditionals to display different HTML where necessary. $terms = array( array( … Read more

Page gets displayed in post field

It looks like you are attempting to create a secondary archive/index page on the “events” template, but haven’t modified the main query for the page. Without that, you will only get results for the one page. Try: function events_wpse_206465($qry) { if (is_page(‘events’) && is_main_query()) { $qry->set(‘posts_per_page’,5); $qry->set(‘post_type’,’events’); } } add_action(‘pre_get_posts’,’events_wpse_206465′); Or create a new query: … Read more

How to execute custom loop before loop content?

Try using the genesis_before_content hook. add_action(‘genesis_before_content’, ‘gt_custom_loop’); function gt_custom_loop() { // this gets executed after the page content, how to make it execute before? }

Cant pull in featured Image

You won’t get anything back from your template simply because the loop returns what is in the main query object for that specific page. To see what is actually in the main query object, you should do var_dump( $wp_query ); outside the loop. To display custom content on a page template, you will need to … Read more

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

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

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

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