• Home
  • About me
  • Gallery
  • WordPress
  • Life
  • Contact us

Laxman Prajapati

~ WordPress Blog

Laxman Prajapati

Monthly Archives: April 2014

Get search form WordPress

09 Wednesday Apr 2014

Posted by Laxman Prajapati in WordPress

≈ 1 Comment

Tags

Get search form WordPress, wordpress search form

Usage

Display search form using searchform.php Theme file.

 get_search_form(); 

Examples

If you don’t have searchform.php in your Theme, WordPress will render its built-in search form:

<form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">
    <div><label class="screen-reader-text" for="s">Search for:</label>
        <input type="text" value="" name="s" id="s" />
        <input type="submit" id="searchsubmit" value="Search" />
    </div>
</form>

The above form is used on HTML4 websites. If your theme supports HTML5, which happens if it uses add_theme_support(‘html5’, array(‘search-form’)); it will output the following HTML form. This is the case since WordPress 3.6.

<form role="search" method="get" class="search-form" action="<?php echo home_url( '/' ); ?>">
	<label>
		<span class="screen-reader-text">Search for:</span>
		<input type="search" class="search-field" placeholder="Search …" value="" name="s" title="Search for:" />
	</label>
	<input type="submit" class="search-submit" value="Search" />
</form>

Rate this:

Share this:

  • Facebook
  • Twitter
  • LinkedIn
  • Pinterest
  • Email
  • Print

Like this:

Like Loading...

How Edit Search Form Using Hooks: WordPress

08 Tuesday Apr 2014

Posted by Laxman Prajapati in WordPress

≈ 12 Comments

Raghunath Gurjar

Hello Friends!

Hope you are doing well 🙂

If you want to edit the html of default search form in your wordpress website, then don’t warry 🙂 just add my code in your theme function file.

raghu-blog

/********************************************
 * Start search form hookes part here
*********************************************/
function my_search_form( $form ) {
    $form = '<form role="search" method="get" id="searchform" class="searchform" action="' . home_url( '/' ) . '" >
    <div>
    <input type="text" value="' . get_search_query() . '" name="s" onblur="if (this.value == '') {this.value = 'Search';}" onfocus="if (this.value == 'Search') {this.value = '';}" id="setop"/>
    <input type="submit" id="searchsubmit" value="'. esc_attr__( 'Search' ) .'" />
    </div>
    </form>';

    return $form;
}

add_filter( 'get_search_form', 'my_search_form' );
/********************************************
 * End hookes part here
*********************************************/

Enjoy Code! | Raghunath Blog

View original post

Rate this:

Share this:

  • Facebook
  • Twitter
  • LinkedIn
  • Pinterest
  • Email
  • Print

Like this:

Like Loading...

Why use a Child Theme in WordPress ?

08 Tuesday Apr 2014

Posted by Laxman Prajapati in Blog, WordPress

≈ 2 Comments

Tags

Child Theme in WordPress, Why use a Child Theme in WordPress

wordpress-child-themes

  • If you modify an existing theme and it is updated, your changes will be lost. With a child theme, you can update the parent theme (which might be important for security or functionality) and still keep your changes.
  • It can speed up development time.
  • It’s a great way to get started if you are just learning WordPress theme development.

Rate this:

Share this:

  • Facebook
  • Twitter
  • LinkedIn
  • Pinterest
  • Email
  • Print

Like this:

Like Loading...

Create custom navigation menu in WordPress

07 Monday Apr 2014

Posted by Laxman Prajapati in Blog, WordPress

≈ 2 Comments

Tags

custom navigation menu in WordPress, wordpress menu, wordpress navigation

Custom-Navigation-Menus-WordPress-Themes

Register Menus

Firstly, in your theme’s functions.php, you need to write a function to register the names of your menus. (This is how they will appear in the Appearance -> Menus admin screen.) As an example, this menu would appear in the “Theme Locations” box as “Header Menu”.

function register_my_menu() {
  register_nav_menu('header-menu',__( 'Header Menu' ));
}
add_action( 'init', 'register_my_menu' );

And this would make two menu options appear, header menu and extra menu –

function register_my_menus() {
  register_nav_menus(
    array(
      'header-menu' => __( 'Header Menu' ),
      'extra-menu' => __( 'Extra Menu' )
    )
  );
}
add_action( 'init', 'register_my_menus' );

Display Menus on Theme

Once you’ve done that, your theme will be almost ready. The last preparation step is to tell the theme where you want the menus to show up. You do this in the relevant theme file. So, for example, we might want our header menu to be in header.php. So open up that file in the theme editor, and decide where you want to put your menu. The code to use here is wp_nav_menu which we will need once for each menu location. So, add this code –

<?php wp_nav_menu( array( 'theme_location' => 'header-menu' ) ); ?>

All you need to ensure is that the theme_location points to the name you provided for your menu in the functions.php code above. (Note that it’s the header-menu being used here rather than Header Menu without a hyphen. header-menu is the name that the code understands, Header Menu is the human-readable version that you see in the admin page.)

To complete the code, you can put your extra menu someplace else. Maybe you want a menu on one of your pages, for example, and you might even want it to be jazzed up a little with a containing DIV of a certain class –

wp_nav_menu( array( 'theme_location' => 'extra-menu', 'container_class' => 'my_extra_menu_class' ) );

So you’d put the above into your Page template, and not only would the menu show up wherever you put it, it’d be styled as my_extra_menu_class so that you can work with that in CSS.

Rate this:

Share this:

  • Facebook
  • Twitter
  • LinkedIn
  • Pinterest
  • Email
  • Print

Like this:

Like Loading...

Display Blog Posts on any Page (with navigation)

06 Sunday Apr 2014

Posted by Laxman Prajapati in Blog, WordPress

≈ 3 Comments

Tags

blog, Blog post

Create a blank page template named “page-blog.php” and include the following code:

<?php 
/*
	Template Name: Blog
*/
?>
<?php get_header(); ?>

	<article>

		<?php // Display blog posts on any page @ http://m0n.co/l
		$temp = $wp_query; $wp_query= null;
		$wp_query = new WP_Query(); $wp_query->query('showposts=5' . '&paged='.$paged);
		while ($wp_query->have_posts()) : $wp_query->the_post(); ?>

		<h2><a href="<?php the_permalink(); ?>" title="Read more"><?php the_title(); ?></a></h2>
		<?php the_excerpt(); ?>

		<?php endwhile; ?>

		<?php if ($paged > 1) { ?>

		<nav id="nav-posts">
			<div class="prev"><?php next_posts_link('&laquo; Previous Posts'); ?></div>
			<div class="next"><?php previous_posts_link('Newer Posts &raquo;'); ?></div>
		</nav>

		<?php } else { ?>

		<nav id="nav-posts">
			<div class="prev"><?php next_posts_link('&laquo; Previous Posts'); ?></div>
		</nav>

		<?php } ?>

		<?php wp_reset_postdata(); ?>

	</article>

<?php get_footer(); ?>

Rate this:

Share this:

  • Facebook
  • Twitter
  • LinkedIn
  • Pinterest
  • Email
  • Print

Like this:

Like Loading...

How to stop WordPress asking for ftp details

05 Saturday Apr 2014

Posted by Laxman Prajapati in Blog, WordPress

≈ 6 Comments

PHP Technology Tutorials

You can install plugin and theme easily from wordpress backend. But sometime due to folder permission WordPress may ask ftp details to install plugins in site. You can prevent asking ftp details just open wp-config.php file from the root folder of wordpress installation then write following php code

define('FS_METHOD', 'direct');

save the file to apply changes. Now you can install plugin or themes in wordpress backend.

View original post

Rate this:

Share this:

  • Facebook
  • Twitter
  • LinkedIn
  • Pinterest
  • Email
  • Print

Like this:

Like Loading...

Write custom hooks in WordPress

05 Saturday Apr 2014

Posted by Laxman Prajapati in Blog, WordPress

≈ Leave a comment

PHP Technology Tutorials

WordPress allow us to create custom hooks. You can write your custom hooks in WordPress as par requirement. In following example you will learn how to write custom hooks in WordPress. Two function are useful to create a new hook , first is add_action() and second is do_action().

View original post 62 more words

Rate this:

Share this:

  • Facebook
  • Twitter
  • LinkedIn
  • Pinterest
  • Email
  • Print

Like this:

Like Loading...

Iist wordpress posts from current category only

05 Saturday Apr 2014

Posted by Laxman Prajapati in Blog, WordPress

≈ 2 Comments

Tags

get post, wordpress post

Here is my template code I have been using

<ul id="catnav">

     <?php
     global $post;
     $myposts = get_posts('numberposts=5&category=1');
     foreach($myposts as $post) :
     ?>
        <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
     <?php endforeach; ?>



    </ul>

Rate this:

Share this:

  • Facebook
  • Twitter
  • LinkedIn
  • Pinterest
  • Email
  • Print

Like this:

Like Loading...

Positive thinking people are HEALTHIER

04 Friday Apr 2014

Posted by Laxman Prajapati in Health, Life, Positive

≈ 23 Comments

Tags

Positive, Positive thinking

Positive_Thinking

It’s still somewhat unclear to researchers why people who practice positive thinking experience these health benefits. One theory is that having a positive outlook enables you to cope better with stressful situations, which reduces the harmful health effects of stress on your body. Hello, who wants less stress?

– by JONATHAN

Rate this:

Share this:

  • Facebook
  • Twitter
  • LinkedIn
  • Pinterest
  • Email
  • Print

Like this:

Like Loading...

Gallery

Lovely Dogs

03 Thursday Apr 2014

Posted by Laxman Prajapati in Animal

≈ 10 Comments

Tags

dogs, lovely dogs

This gallery contains 9 photos.

Rate this:

Liebster Award!

02 Wednesday Apr 2014

Posted by Laxman Prajapati in WordPress

≈ 6 Comments

A Crafty Blog...

Liebster Award! 🙂

WOW! Thank you so much Night’sWatchBlog for the nomination! What an amazing suprise! 🙂

So here’s how it works…..• Thank the blogger that nominated you
• Answer the 11 questions you were given
• Nominate 11 other bloggers with less than 500 followers
• Post 11 questions for your nominee to answer
• Tag your nominees and post a comment in their blog so they know they’ve been nominated.

The questions I was given to answer 

1. Why did you start blogging? – I started blogging so I can receive tips on how to be a better crafter. It’s a fun way to share and document my ongoing projects. To appreciate seeing great pictures and reading material of what everyone’s up to. I’m a little nosy in that sense!
2. How has your blog evolved over time? – I’m still pretty new, but I suppose…

View original post 443 more words

Rate this:

Share this:

  • Facebook
  • Twitter
  • LinkedIn
  • Pinterest
  • Email
  • Print

Like this:

Like Loading...

Positive thinking people are HAPPIER

02 Wednesday Apr 2014

Posted by Laxman Prajapati in Happiness, Life, Positive

≈ 8 Comments

Tags

Be happy forever, Positive, Positive thinking

4057782618_8a9b07cc40

Pessimists are more inwardly focused and have more depression, anxiety and other mental health problems in general. Positive people have a greater capacity for love, joy and warmth that brings happiness into their lives, and also into the lives of their families and everyone else around them. This increased capacity for love means that they are loved more in return because they are more outwardly focused, kinder and more considerate to others.

– by JONATHAN

Rate this:

Share this:

  • Facebook
  • Twitter
  • LinkedIn
  • Pinterest
  • Email
  • Print

Like this:

Like Loading...

Image

Animal Garden

01 Tuesday Apr 2014

Tags

animal, animal garden

129747_l

Wooden_Lizard_Risley_Moss
xgarden-decoration.jpeg.pagespeed.ic.vYGc-Wf00a
modern-garden-sculptures
Garden_Lizard
NE100048
410w
philip-s-animal-garden
crocodile-sculpture-park

Rate this:

Share this:

  • Facebook
  • Twitter
  • LinkedIn
  • Pinterest
  • Email
  • Print

Like this:

Like Loading...

Posted by Laxman Prajapati | Filed under Animal

≈ 31 Comments

Newer posts →
Follow Laxman Prajapati on WordPress.com

About Me

Laxman Prajapati

Laxman Prajapati

Have to lose something to gain something

View Full Profile →

Total Blog Hits

  • 29,286 Views

Fish

Calendar

April 2014
M T W T F S S
 123456
78910111213
14151617181920
21222324252627
282930  
« Mar   May »

Logo

wordpress-logo-stacked-rgb

Category

Animal Anniversary birthday Blog BuddyPress Family Flower Friends Goal Google Happiness Happy new year Health Independence Day Life Love Mind Fresh Natural PHP Positive Republic Day WordPress

Blogs I Follow

Success Life

“Success is not final, failure is not fatal: it is the courage to continue that counts.” ― Winston Churchill
“If at first you don't succeed, try, try again. Then quit. No use being a damn fool about it.” ― W. C. Fields
“Nearly all men can stand adversity, but if you want to test a man's character, give him power.” ― Abraham Lincoln
“Success is most often achieved by those who don't know that failure is inevitable.” ― Coco Chanel

Recent Posts

  • How to increase WordPress website speed without a plugin
  • How to install Twnety Twenty theme on WordPress Website?
  • How to download PDF file using WordPress codex
  • New Gallery Widget in WordPress 4.9
  • Template Hierarchy
  • WordPress Work Sheet
  • Merry Christmas
  • #SRK

Category

Animal Anniversary birthday Blog BuddyPress Family Flower Friends Goal Google Happiness Happy new year Health Independence Day Life Love Mind Fresh Natural PHP Positive Republic Day WordPress

Gallery

success2
succaess
15_5_orig
success-secrets-1
sucscess
success
success
success-1
tree_success

Blog at WordPress.com.

Tianu Gujarati Blog - Anurag Rathod

જેને કશું કામ કરવા ના હોય એ નવરો બેઠો બેઠો બ્લોગ લખે.

WordCamp Ahmedabad 2019 a.k.a 3.0

#WCAhmedabad

Hinal Sanghvi

Hinal Sanghvi

WordPress Educator Zac Gordon

A Blog for Tutorials, Free Videos, and Updates on Courses, Talks and Workshops

seenu625

love nature, and all things creative

Hello Beautiful Book Blog

beautiful nerdy bookish things

How Useful It Is

Trying to be Useful, one post at a time!

vlandaman.wordpress.com/

On Becoming Fearless

Dreaming, believing, learning then achieving

Dil Ki Kitaab ( दिल की किताब )

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Follow Following
    • Laxman Prajapati
    • Join 522 other followers
    • Already have a WordPress.com account? Log in now.
    • Laxman Prajapati
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar
 

Loading Comments...
 

    %d bloggers like this: