Wordpress SEO - What are you looking for?

If you're looking for answers to SEO or wordpress related questions, type in a phrase and wait for hints or click enter! The results also show links to external sources.

161 articles in the database

Full Loop WordPress

[ Article content is protected by Plagiashield ]

wordpress-loop

WordPress loop is a marvel in itself. Flexible, correctly described, perfectly working. With this short, but optimistic sentence I invite you to describe the loop WordPress with examples.

What in the WordPress loop can be apply, like it looks like from the examples and what yet can we get out of her? Why is it worth taking a closer look? ThereforeThe fact that we have almost everything we need ready to go is one of the reasons why developers are so eager to choose WordPress. No matter what, whether we're going to want to display entries just a particular author, or all of them, or maybe we decide to display the author's 2016 posts that they added with the tag "wordpress"in the "tutorials" category? All this, thanks to the magic of the CMS, can be done without writing dozens of lines of code. I invite you to the entry.

You can also find a full description of the opportunity here: https://codex.wordpress.org/Class_Reference/WP_Query

The simplest WordPress loop that we'll start the entire post with looks like this:

have_posts() ) {
    echo '
    ; while ( $the_query->have_posts() ) { $the_query->the_post(); echo '
  • ' . get_the_title() . '
  • '; } echo '
'; /* We reset our loop, you never know if we don't need a second one */. wp_reset_query(); } else { echo '

Add some entries!

'; echo '

If you added any, check the category and validity of the code

'; } ?>

It's really simple, fun and most importantly it works. However, such a function can have a lot of parameters. The parameters are given in the following way:

$args = array( );

That is, for example:

 5
);

Let's see what parameters we can use. These are not all the possibilities just those mostly is being used.

Category parameters

"cat"=>1 - always as an int variable, the category number, we retrieve it, e.g. by editing the function, we find the ID of our category on the bar address.
cat-url
category_name" => "name" - display the categories with the given name, remember that it is a short name
category__not_in" => array( 2, 4) - the opposite of the above, we display entries that are not in the above categories.

Tag parameters

"tag" => "great", - our tag name,
tag_id" => 5, - ID of our wonderful tag,
'tag__and' => array( 2, 6), - table of our wonderful tags

Parameters concerning an entry

"post_type" => array(
post." - our type of entry,
new-type-inscription", - another type of entry is given just like this,
page", - our website,
revision", - our entry designation,
),

Status of our entry

"post_status" => array(
publish", - entry published
pending." - entry ready for review
Draft." - entry tagged sketch
),

Parameters related to publication time

"year" => 2016, - year of our entry (will display entries published in this year)
monthnum" => 7, - entry month
day" => 12, - publication date
hour" => 12, - time of publication
minute" => 12, - minutes of publication
second" => 12, - seconds of publication

Sometimes you also have to just solve some problems, even if it's not the maximum optimal solution. This is usually when the most monsters are created. It should be remembered that the more we apply our own solutions similar to IF in the loop, the harder such pageswill be maintained. One of such monsters I presented in the last post "7 interesting solutions".

ID , 'taxonomy_for_our_type_insert' );
foreach ( $terms as $term ) {
if ($term->name=='our_lobbied_taxonomy') {
echo ' I'm here! ';
}
}
}
?>

It is worth noting in this example that we will sometimes come to use "global $post;" to pull other data about an entry.

Summary

Now that we understand all of this, it's time to make our lives easier, for this we have https://generatewp.com/wp_query/ This is a tool that will allow us to generate loops in a convenient way, although it does not support all parameters, but in 90% cases it will come in handy.
It's worth adding that we will handle loops for Woocomber in a similar way, only first we need a closer look at its documentation. Always in the case of WordPress start with this to try to solve your problem.

Avatar

O Karol Trybulski

His adventure with creating websites started when HTML 3 was fashionable. Now he creates not only websitesBut also effectively positions them. Since the end of 2014 he manages his own brand InBulb
  • Internal Links and Sematics

  • Link building
  • Sematics
  • Link building has never been easier. Hundreds of link possibilities in one click.
  • See

[ Article content is protected by Plagiashield ]

SEMRush - the best tool for SEO and PPC.

en_USEnglish
Read previous post:
6trend
6 web design trends in 2017

Slowly approaching the end of 2016, which as always was saturated with various changes and news in the world of web design....

Close