In: Wordpress

Set page template for all pages in wordpress with database update via functions.php
April 27, 2018

Set page template for all pages in wordpress with database update via functions.php add_action( ‘admin_init’, ‘set_page_templates’ ); function set_page_templates(){ $current_template =…

Read More
How to override or change template forcefully for posts with functions.php?
April 27, 2018

add_action( ‘admin_init’, ‘set_page_templates’ ); function set_page_templates(){ $current_template = get_post_meta( $page->ID, ‘_wp_page_template’, true ); echo $current_template.’amit’; foreach( get_posts(‘post_type=post&posts_per_page=-1’) as $page ) {…

Read More
How to build a WordPress Post Pagination without plugin?
March 14, 2018

The function Paste this function code in your theme functions.php file: if ( ! function_exists( ‘post_pagination’ ) ) : function post_pagination()…

Read More
How to add menu page with different name for first submenu item in wordpress?
March 12, 2018

You can make the ‘slug’ for the submenu page equal that of the top level page, and they’ll point to the…

Read More
How to create custom widgets in WordPress?
March 12, 2018

Creating a Custom Widget in WordPress You can also paste the below code in your theme’s functions.php file. However, it will…

Read More
How to remove srcset in wordpress : Logo Problem | Images Problem
March 11, 2018

// Clean the up the image from wp_get_attachment_image() add_filter( ‘wp_get_attachment_image_attributes’, function( $attr ) { if( isset( $attr[‘sizes’] ) ) unset( $attr[‘sizes’]…

Read More
How do I disable responsive images in WP 4.4?
March 11, 2018

// Clean the up the image from wp_get_attachment_image() add_filter( ‘wp_get_attachment_image_attributes’, function( $attr ) { if( isset( $attr[‘sizes’] ) ) unset( $attr[‘sizes’]…

Read More
Get Unique Post Meta Values From Meta Key
June 14, 2017

Get Unique Post Meta Values From Meta Key <?php /* Don't include the opening PHP tag*/ * @param string $key Post…

Read More
How to make a custom widget area in wordpress?
May 20, 2017

custom widget area in wordpress custom widget area in wordpress WordPress Amitpal Singh First of all place this code in function.php…

Read More
How to Add Page Slug in Body Class of your WordPress Theme ?
May 12, 2017

Page Slug in body class Page Slug in body class WordPress Amitpal Singh Put this in your theme functions.php //Page Slug…

Read More