Mobile-Menu iFuturz Infoweb Inc. Contact Portfolio

24

Jul

Useful functions that are used to implement wordpress theme

Useful functions that are used to implement wordpress theme

Posted On : July 24, 2013

| 1 Comment

get_bloginfo(‘home’)

It retrieves the home URL for the current site.

bloginfo(‘description’)

Displays the “Tagline” set in Setting >General . This data is retrieved from the “blogdescription” record in the wp_options table.

bloginfo(‘name’)

Displays the “Site Title” set in Setting >General. This data is retrieved from the “blogname” record in the wp_options table.

bloginfo(‘template_directory’)

Displays URL of the active theme’s directory.

the_content()

Displays the contents of the current post and the text “read more” will not show up.

the_tags(”, ‘.’, ”)

Returns an array of objects, one object for each tag assigned to the post. This tag must be used within The loop.

the_time(‘F jS, Y’)

Displays the time in the date format ‘F j, Y’ (ex: December 2, 2004), which could be used to replace the tag the_date()

the_ID()

Displays the numeric ID of the current post. This tag must be within the loop.

the_author()

Displays Author’s name of post.

get_avatar( $comment, 80 )

Retrieve the avatar for a user who provided a user ID or email address. Most commonly used in the comments section.

comment_text( $comment_ID )

Displays the text of a comment and the ID of the comment for which to print the text.

the_permalink()

Displays the URL for the to the post currently being processed in the loop. This tag must be within the loop, and is generally used to display the permalink for each post, when the posts are being displayed.

previous_post_link(‘%link’, ‘Previous Post’)

displays a link to the previous post which exists in chronological order from the current post. This tag must be used in the loop.Here “%link” is used for making linkable and “Previous Post” for title.

next_post_link(‘%link’, ‘Next Post’)

displays a link to the Next post which exists in chronological order from the current post. This tag must be used in the loop. Here “%link” is used for making linkable and “’Next Post” for title.

posts_nav_link(”,”,’« Previous Entries’)

displays a link to the previous page with an anchor text as “Previous Entries”. Useful for providing “paged” navigation of index, category and archive pages.

posts_nav_link(”,’Next Entries »’,”)

displays a link to the next page with an anchor text as “Next Entries “. Useful for providing “paged” navigation of index, category and archive pages.

previous_image_link()

This creates a link to the previous image attached to the current post. Whenever a series of images are linked to the attachment page, it will put a ‘previous image link’ with the images when viewed in the attachment page.

next_image_link()

This creates a link to the next image attached to the current post. Whenever a series of images are linked to the attachment page, it will put a ‘next image link’ with the images when viewed in the attachment page.

wp_nav_menu( array( ‘theme_location’ => ‘primary’, ‘menu_class’ => ‘nav-menu’ ) )

Displays a navigation menu created in the Appearance → Menus panel. The class that is applied to the ul element which encloses the menu items. Multiple classes can be separated with spaces.

dynamic_sidebar( ‘sidebar-1′ )

This function calls each of the active widget callbacks in order, which prints the markup for the sidebar . If you have more than one sidebar, you should give this function the name or number of the sidebar you want to print. This function returns true on success and false on failure. “sidebar-1” is name or id of dynamic sidebar.

get_header()

Includes the header.php template file from your current theme’s directory. if a name is specified then a specialised header header-{name}.php will be included.

get_sidebar()

Includes the sidebar.php template file from your current theme’s directory.

get_footer()

Includes the footer.php template file from your current theme’s directory. if a name is specified then a specialised footer footer-{name}.php will be included.

comments_template()

Loads the comment template. For use in single Post and Page displays.

get_template_part( ‘content’, ‘page’)

Load a template part into a template (other than header, sidebar, footer). Makes it easy for a theme to reuse sections of code and an easy way for child themes to replace sections of their parent theme.

  • Tags:

Comment

Posts

  • Thanks for your great information, the contents are quiet interesting.I will be waiting for your next post.

    vivek