How to Add Content In Homepage Only, Page 2 Only, Specific Category, And Specific Tag

Adding content in homepage only

<?php if(is_home() && !is_paged() ) { ?>
-- YOUR CONTENT HERE --
<?php } ?>

Adding content in page/2 only

<?php 
// get current page we are on. If not set we can assume we are on page 1.
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
// are we on page two?
if(2 == $paged) {
 ?>
-- YOUR CONTENT HERE --
<?php } ?>

Adding content in tag ‘health’ only

<?php if ( is_tag('health') ) { ?>
-- YOUR CONTENT HERE --
<?php } ?>

Adding content in category ‘movie review’ only

<?php if ( is_category('movie-review') ) { ?>
-- YOUR CONTENT HERE --
<?php } ?>

 

In case you’re interested in knowing more info on makeup training nyc, stop by http://www.ninamua.com

Visit http://www.edgesigns.com to find out more regarding retractable awning

Visit marketerium.com to find out more regarding seo san diego

How to Crop Image Thumbnail From Top Center – WordPress Tutorial

I’ve been searching about how to crop image thumbnail from the top center (instead of default center center), but unfortunately the only thing to solve this problem is by editing the core.

Open wp-includes – media.php. Find this lines:

$s_x = floor( ($orig_w - $crop_w) / 2 );
$s_y = floor( ($orig_h - $crop_h) / 2 );

And replace with this code:

$s_x = floor( ($orig_w - $crop_w) / 2 );
$s_y = 0; //floor( ($orig_h - $crop_h) / 2 );

And then you need to regenerate your thumbnails using plugins, Regenerate Thumbnails. This step will automatically crop all the post thumbnails again.

How to Find Category ID on WordPress

To find a categories ID, you need to logged in and go to your dashboard. Open Posts – Categories, and click on one of the category names. The url of the page you are on will show what the category id is. For example, in URL below, your Category ID is 13.

https://www.webminimalist.com/wp-admin/edit-tags.php?action=edit&taxonomy=category&tag_ID=13&post_type=post

How To Create Sleek Page Navigation in WordPress Without Plugin

page navigation without plugin
This is tutorial about how to adding Page Navigation in your WordPress theme without any plugin.

Open functions.php, and add code below.

/* Adding Page Navigation ********************************************/

	function pagenavi( $p = 2 ) { // pages will be show before and after current page
	  if ( is_singular() ) return; // don't show in single page
	  global $wp_query, $paged;
	  $max_page = $wp_query->max_num_pages;
	  if ( $max_page == 1 ) return; // don't show when only one page
	  if ( empty( $paged ) ) $paged = 1;
	  // echo '<span class="pages">Page: ' . $paged . ' of ' . $max_page . ' </span> '; // pages
	  if ( $paged > $p + 1 ) p_link( 1, 'First' );
	  if ( $paged > $p + 2 ) echo '... ';
	  for( $i = $paged - $p; $i <= $paged + $p; $i++ ) { // Middle pages
	    if ( $i > 0 && $i <= $max_page ) $i == $paged ? print "<span class='page-numbers current'>{$i}</span> " : p_link( $i );
	  }
	  if ( $paged < $max_page - $p - 1 ) echo '... ';
	  if ( $paged < $max_page - $p ) p_link( $max_page, 'Last' );
	}
	function p_link( $i, $title = '' ) {
	  if ( $title == '' ) $title = "Page {$i}";
	  echo "<a class='page-numbers' href='", esc_html( get_pagenum_link( $i ) ), "' title='{$title}'>{$i}</a> ";
	}

And then add <?php pagenavi(); ?> anywhere after the loop. Example: Continue reading