Dynamic Sidebar in WordPress is generally used for access of Widget in sidebar or place where we want to display widget....?
It is all about programming. A blog about PHP, MYSQL, Javascript, Jquery,AJAX,HTML & CSS tutorial. Get short trick, knowledge based snippet for programming and technology related ideas.
Showing posts with label Wordpress. Show all posts
Showing posts with label Wordpress. Show all posts
Friday, 1 February 2019
How to create Dynamic Sidebar for widget in WordPress
How to add defer or async attributes to WordPress Script
Thursday, 31 January 2019
Get list of particular category and its subcategory in wordpress
Hi friends, today i am going to discuss about how to get particular list of category and...,.....
Labels:
category,
get,
particular,
subcategory,
Wordpress
How to get post by category in WordPress
Hi guys,if we talk about WordPress or any other CMS(Content Management System) , then a ......
How To Add Custom Icon To WordPress Nav Menu
In this tutorial we will discuss how to add custom icon to WordPress nav menu. You have seen menu icon.....
Read more
Monday, 12 September 2016
Add tinymce editor in bbpress forum
<?php bbp_the_content( array( 'context' => 'topic','tinymce' => true ) ); ?>
Just add :
'tinymce' => true //as shown in above array
Thursday, 21 July 2016
Disable Contact Forms for All Users Except Admin
Put the below snippet in wp-config.php file
define( 'WPCF7_ADMIN_READ_CAPABILITY', 'manage_options' );
define( 'WPCF7_ADMIN_READ_WRITE_CAPABILITY', 'manage_options' );
define( 'WPCF7_ADMIN_READ_CAPABILITY', 'manage_options' );
define( 'WPCF7_ADMIN_READ_WRITE_CAPABILITY', 'manage_options' );
Wednesday, 20 July 2016
Add class attribute to comment form in Wordpress
comment_form ( array( 'class_form' => 'skyform' ,'class_submit' => 'button seven') );
Friday, 10 June 2016
How to get menu title in loop wordpress
<?php
$menu = 'Menu Name';
$menu_items = wp_get_nav_menu_items($menu);
foreach ( (array) $menu_items as $key => $menu_item ) {
$title = $menu_item->title;
$url = $menu_item->url;
}
?>
How to assign an ID to a Wordpress Menu
<?php wp_nav_menu( array( 'theme_location' => 'main-menu', 'menu' =>'Menu 1','items_wrap'=> '<ul id="main-menu">%3$s</ul>') ); ?>
How to get the category in loop wordpress
$category = get_the_category();
foreach( $category as $cat ){
$category_name .= $cat -> cat_name;
}
echo $category_name;
Monday, 29 February 2016
How to update media url in Wordpress
Simple query you have to execute on your dtabase . Just take a backup before change anything.
UPDATE wp_posts SET guid = replace(guid, 'http://www.olddomain.com','http://www.newdomain.com');
UPDATE wp_posts SET guid = replace(guid, 'http://www.olddomain.com','http://www.newdomain.com');
Tuesday, 23 February 2016
Custom Post Query In Wordpress
<?php
global $post;
$dataargs = array( 'posts_per_page' =>2, 'offset'=> 0, 'category' => 432 );
// 432 is a cat id
$specialposts = get_posts( $args );
foreach( $specialposts as $post ) : setup_postdata($post); ?>
<div class="pi-grid-item" >
<article class="post">
<div class="post-media">
<h4 class="widget-title"><?php echo the_title();?><span></span></h4>
<div class="images"><a href="<?php echo the_permalink();?>"><?php echo the_post_thumbnail(array(50,75)); ?></a></div>
<p style="margin-top:10px;"><?php echo the_content();?></p>
<a href="<?php echo the_permalink();?>" class="alignright">Read More</a>
</div>
</article>
</div
<?php endforeach; ?>
Alternate:
<?php
$args=array(post_type=>post, cat=>432,posts_per_page=>6);
query_posts($args);
if(have_posts()){
while(have_posts()){
the_post(); ?>
<?php } } ?>
global $post;
$dataargs = array( 'posts_per_page' =>2, 'offset'=> 0, 'category' => 432 );
// 432 is a cat id
$specialposts = get_posts( $args );
foreach( $specialposts as $post ) : setup_postdata($post); ?>
<div class="pi-grid-item" >
<article class="post">
<div class="post-media">
<h4 class="widget-title"><?php echo the_title();?><span></span></h4>
<div class="images"><a href="<?php echo the_permalink();?>"><?php echo the_post_thumbnail(array(50,75)); ?></a></div>
<p style="margin-top:10px;"><?php echo the_content();?></p>
<a href="<?php echo the_permalink();?>" class="alignright">Read More</a>
</div>
</article>
</div
<?php endforeach; ?>
Alternate:
<?php
$args=array(post_type=>post, cat=>432,posts_per_page=>6);
query_posts($args);
if(have_posts()){
while(have_posts()){
the_post(); ?>
<?php } } ?>
Thursday, 4 February 2016
How to exclude a category in wordpress Post
<?php query_posts('cat=-427');
if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
OR
<?php query_posts('posts_per_page=30&cat=-427,-432');
if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
OR
<?php query_posts('posts_per_page=30&cat=-427,-432');
if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
How to set class attribute in contact form 7 Wordpress Plugin
<p class="form-item">First Name (required)<br />
[text* your-name] </p>
<p class="form-item">Last Name (required)<br />
[text* LastName]</p>
<p class="form-item">Your Email (required)<br />
[email* your-email] </p>
<p class="form-item">Your Phone Number <br />
[tel YourPhoneNumber]</p>
<p class="form-item">Other information that you think might be helpful (optional): <br />
[textarea your-message] </p>
<p class="form-item">Upload Resume<br />
[file UploadResume limit:200000 filetypes:.docx]</p>
<p class="form-submit">[submit "Send"]</p>
[text* your-name] </p>
<p class="form-item">Last Name (required)<br />
[text* LastName]</p>
<p class="form-item">Your Email (required)<br />
[email* your-email] </p>
<p class="form-item">Your Phone Number <br />
[tel YourPhoneNumber]</p>
<p class="form-item">Other information that you think might be helpful (optional): <br />
[textarea your-message] </p>
<p class="form-item">Upload Resume<br />
[file UploadResume limit:200000 filetypes:.docx]</p>
<p class="form-submit">[submit "Send"]</p>
Tuesday, 8 December 2015
How to add Search box in Header in Wordpress
//Just put this code in header file where you want to display search box
<form method="get" id="searchform" action="<?php bloginfo('home'); ?>/">
<div><input type="text" size="25" value="<?php echo wp_specialchars($s, 1); ?>" name="phpcluster" id="phpcluster" />
<input type="submit" id="searchsubmit" value="Search" class="php cluster" />
</div>
</form>
<form method="get" id="searchform" action="<?php bloginfo('home'); ?>/">
<div><input type="text" size="25" value="<?php echo wp_specialchars($s, 1); ?>" name="phpcluster" id="phpcluster" />
<input type="submit" id="searchsubmit" value="Search" class="php cluster" />
</div>
</form>
Monday, 7 December 2015
Get page content by page name or id in Wordpress
// By Page name
<?php
$page = get_page_by_title( 'controls' );
$content = apply_filters('the_content', $page->post_content);
echo $content;
?>
//By page id
<?php
$id=31;
$post = get_post($id);
$content = apply_filters('the_content', $post->post_content);
echo $content;
?>
<?php
$page = get_page_by_title( 'controls' );
$content = apply_filters('the_content', $page->post_content);
echo $content;
?>
//By page id
<?php
$id=31;
$post = get_post($id);
$content = apply_filters('the_content', $post->post_content);
echo $content;
?>
Sunday, 1 November 2015
add attributes on achor in wordpress navigation menu
//dropdown toggle
add_filter( 'nav_menu_link_attributes', 'add_class_to_items_link', 10, 3 );
function add_class_to_items_link( $atts, $item, $args ) {
// check if the item has children items
$hasChildren = (in_array('menu-item-has-children', $item->classes));
if ($hasChildren) {
// add the desired attributes:
$atts['class'] = 'dropdown-toggle';
$atts['data-toggle'] = 'dropdown';
$atts['data-target'] = '#';
}
return $atts;
}
add_filter( 'nav_menu_link_attributes', 'add_class_to_items_link', 10, 3 );
function add_class_to_items_link( $atts, $item, $args ) {
// check if the item has children items
$hasChildren = (in_array('menu-item-has-children', $item->classes));
if ($hasChildren) {
// add the desired attributes:
$atts['class'] = 'dropdown-toggle';
$atts['data-toggle'] = 'dropdown';
$atts['data-target'] = '#';
}
return $atts;
}
Tuesday, 27 October 2015
change related products thumbnail size in WooCommerce
change in this file which shown below
wp-content/plugins/woocommerce/includes/ wc-template-functions.php
filename : wc-template-functions.php
function woocommerce_template_loop_product_thumbnail() {
echo str_replace('-300x300','',woocommerce_get_product_thumbnail());
}
}
wp-content/plugins/woocommerce/includes/ wc-template-functions.php
filename : wc-template-functions.php
function woocommerce_template_loop_product_thumbnail() {
echo str_replace('-300x300','',woocommerce_get_product_thumbnail());
}
}
Sunday, 16 August 2015
how to display post details in wordpress blog
To display blog post in wordpress at custom place we can use these kind of syntax. See the example mentioned below.
<?php
$post = get_post($id); //assume $id has been initialized
setup_postdata($post);
// display the post data of blog here
the_title(); //for title
the_excerpt();
the_post_thumbnail();
wp_reset_postdata();
?>
<?php
$post = get_post($id); //assume $id has been initialized
setup_postdata($post);
// display the post data of blog here
the_title(); //for title
the_excerpt();
the_post_thumbnail();
wp_reset_postdata();
?>
Subscribe to:
Posts (Atom)