Custom Pagination in wp



Add custom pagination in wordpress

Continue reading

Get Id By Slug Or Slug By Id WP


, , , ,

get id by using slug

paste this function in function.php

function get_id_by_slug($page_slug) {
	$page = get_page_by_path($page_slug);
	if ($page) {
		return $page;
	} else {
		return null;


get slug by id

global $post;
$slug = get_post( $post )->post_name;
echo $slug;

Floating Form Or Menu


, , , ,

On Page Scroll Floating Form


*: for easing effect you need jquery easing


  • data-skipheader: if you want to show form after user scroll header or banner section add class name here
  • data-easing: add easing name here to implement easing effect *

Continue reading

Create Short Code with Multiple attributes



We are going to add short code and create some of its attribute

We want to call post data on different pages with different categories and number of posts to show
also we can set post type

add this code in function.php

// This is a function for shortcode 
function custom_shortcode() {
     return 'hi i am short code function';

add_shortcode( 'shortcode', 'custom_shortcode' );

call this by using [shortcode]

Continue reading

Add Category or Tags For Pages


, , ,

We have function that adds an already registered taxonomy to a custom object type.
Suppose we need to add the same categories and tags we use with posts to our Pages.

Here’s how we do it:

register_taxonomy_for_object_type( 'category', 'post' );
register_taxonomy_for_object_type( 'post_tag', 'post' );

Continue reading