How to add ads only at the first post?
It is very simple: <?php if ($wp_query->current_post == 0) : ?> <div style=”float:right”> ads come here. </div> <?php endif; ?> If you don’t want the ads show at homepage, using: <?php if (!is_home())Â ?>
Study PHP Skills, Share PHP Code
It is very simple: <?php if ($wp_query->current_post == 0) : ?> <div style=”float:right”> ads come here. </div> <?php endif; ?> If you don’t want the ads show at homepage, using: <?php if (!is_home())Â ?>
Email is the most popular Internet service today. A plenty of emails are sent and delivered each day. The goal of this tutorial is to demonstrate how to generate and send emails in PHP. So, you want to send automated… Read moreSending Email (Text/HTML/Attachments)
Sometimes you need to add an extra protection to password-protected website. This article explains how access to the login page can be restricted after three unsuccessful login attempts. This schema uses visitors IP address to store log attempts in the… Read moreBlocking access to the login page after three unsuccessful login attempts
Sometimes, you might want to get the current page URL that is shown in the browser URL window. For example if you want to let your visitors submit a blog post to Digg you need to get that same exact… Read moreHow to Get the Current Page URL
First build a database table: CREATE TABLE `su_lockip` ( Â `id` int(4) NOT NULL auto_increment, Â `lockip` varchar(1024) default NULL, Â PRIMARY KEYÂ (`id`) )Â Second, design a page so that you can add the ip you want to ban,… Read moreHow to usp php to ban ip
It is very easy to tag cloud show the same size font and in list style, there are 2 ways to do this: 1. Change sidebar.php in templates: <li> <h2>Tag Cloud</h2> <?php wp_tag_cloud(‘smallest=8&largest=8&number=45&orderby=name&format=list’); ?> <!– wp_tag_cloud(‘smallest=8&largest=8&number=45&orderby=name&format=list’)–> </li> another way is… Read moreHow to let tag cloud show the same size font and in list style?
If you want your posts show from lowest to highest, it is very simple, just add: <!–p query_posts($query_string.’&order=ASC’);–> for example, the following code will let all your post show from lowest to highest: <!–p query_posts($query_string.’&order=ASC’);–> <!–p if (have_posts()) : while… Read moreHow to let the post show from lowest to highest?
If you want to list 50 posts, use the following code: <ul>  <?php  global $post;  $myposts = get_posts(‘numberposts=-1’);  foreach($myposts as $post) :  ?>    <li><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a></li>  <?php endforeach; ?>  </ul> if you want to list all… Read moreList 50 posts of wordpress.
Display a list of 15 posts selected randomly by using the MySQL RAND() function for the orderby parameter value:  <ul><li><h2>A random selection of kingphp posts</h2>    <ul>  <?php  $rand_posts = get_posts(‘numberposts=15&orderby=rand’);  foreach( $rand_posts as $post ) :  ?>    <li><a… Read moreWordPress Random posts
<?php echo realpath(‘./’)?> very simple, right?