Connect with us

Tips & Tricks

Adding a external file after the first post

Published

on

How might you display a Google ad after the first post or anything you like? It is very simple. You just need to add the variable $loopcounter in the Loop. If the $loopcounter is less than or equal to 1, then include your option. Check out the code:

<?php if (have_posts()) : while (have_posts()) : the_post(); $loopcounter++; ?>

  // your loop

  <?php if ($loopcounter <= 1) { include (STYLESHEETPATH . '/you-file.php'); } ?>

<?php endwhile; ?>

<?php else : ?>

<?php endif; ?>

Pretty simple huh. Well in the $loopcounter line, you may change the include to point to any file or maybe a custom widget like so:

<?php if ($loopcounter <= 1) { dynamic_sidebar( 'Plus Post' ); } ?>

Or use your code directly in between the { & }.

Tips & Tricks

Echo custom fields in any category

Published

on

Here is a neat trick. Say you want to show a custom field in you post or in a certain categories post. There is a simple code you need to write in order to accomplish this:

<?php $image = get_post_meta($post->ID, "image", $single = true); ?>
<?php if($image != '') : if(in_category(7)) { echo ''; } else { ?>
<img src="<?php echo $image ?>" alt="<?php the_title(); ?>" /></a>

In the example above I am calling the variable $image and telling the server that it equals the value of “image” inside get_post_meta or “custom field” of the current post.

Then we are asking if that variable $image doesn’t equal nothing or != and if it is in the category id of 7, echo what ever is in the single quotes (which is nothing in this example), otherwise show the <img> and the value inside “image” which should be the location of the image.

Update: Thanks to Austin from PressedWords for pointing out his trick, from the comment below.

Continue Reading

Tips & Tricks

Disable caching of your site or post

Published

on

I talked about Disabling search engine on search pages in a previous post using the meta tag. Today lets go over the web bots Cached copy of your site. If you are working on builder your blog, or have a temporary site up, use the following code:

<meta name="robots" content="noarchive">

This will tell any bot to follow your site, index it, but prevents a cached copy of this page from being available in the search results.

Continue Reading

Tips & Tricks

Disable search engine on search pages

Published

on

A good idea when trying to get the most out of your blog is usging the meta tag to tell the web bots to search & index your site. But for good SEO you should apply this code in your header.php file of your WordPress blog.

<?php if(is_search()) { ?>
<meta name="robots" content="noindex, nofollow" />
<?php }?>

This will keep your site from getting a hit from bots over duplicate entries. 🙂

Continue Reading

Random Search Terms

Title

Recent Posts: Fully Net Worth . com

Gordon Sondland Net Worth: How Rich is the US Ambassador to EU?

Gordon Sondland Net Worth: How Rich is the US Ambassador to EU?

Gordon Sondland is an American businessman and a diplomat. He is the United States Ambassador to the European Union. As of 2019, Gordon Sondland net worth is estimated to be $60 million. Sondland was born on July 16, 1957, in Seattle, Washington to a Jewish family. His parents Gunther Sondland and Frieda fled Europe during […]

Briana DeJesus Net Worth: How Rich is the Teen Mom Star Actually?

Briana DeJesus Net Worth: How Rich is the Teen Mom Star Actually?

Briana DeJesus is an American television personality who is best known for being a part of the reality show called Teen Mom 2 and also appeared in Teen Mom 3. As of 2019, Briana DeJesus net worth is estimated to be $500,000. She was born on May 21, 1994, in Orlando, Florida. Having had kids […]

Jung Joon Young Net Worth: How Rich is the K-Pop Singer?

Jung Joon Young Net Worth: How Rich is the K-Pop Singer?

Jung Joon Young is a former South Korean singer, songwriter, actor, DJ, host, and television superstar. He rose to fame in reality television talent show ‘Superstar K4’ where he finished third place. As of 2019, Jung Joon Young net worth is estimated to be $5 million. Joon-young was born on February 21, 1989, in South […]

Xanman Net Worth: How Rich is the Upcoming Rapper Actually?

Xanman Net Worth: How Rich is the Upcoming Rapper Actually?

Haile Salaam, who is better known by his stage name as Xanman, is an upcoming American rapper who is best known among the rappers on the rise of DMV. He has released several hits including “PINK,” “Gucci Down” and “Hell Yeaa”. As of 2019, Rapper Xanman net worth is estimated to be $400,000. Salaam was […]

Trending