Home » » Wordpress Functions

Wordpress Functions

WordPress using many functions some of the functions is power by PHP (Hypertext Preprocessor) language. we can add more function into wordpress themes by using Plugin or add directly to themes functions.php file.
Now this article will tell you some function of wordpress that wordpress developer usually use when they develop a website and how to use it.

<?php bloginfo( 'siteurl' ); ?>

 using:​ we use this function to get information from wordpress database and table name: wp_options
More example:
<link rel="stylesheet" type="text/css" media="all" href="<?php echo get_bloginfo('stylesheet_url'); ?>" />

<title><?php wp_title( '|', true, 'right' ); ?></title>
using: This function use to display page title



<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js"></script>


<?php wp_head();
wp_footer();
 ?>
<?php get_header(); ?>

The wp_head action hook is triggered between head html tags of the template by the wp_head().
<?php get_footer(); ?>
get_footer it a wp function template file from your current theme's directory. it connect to a file footer.php or  footer-{name}.php
<?php get_sidebar(); ?>

get_sidebar is the same get_footer function it Includes the sidebar.php template file from your current theme's directory or sidebar-{name}.php
<?php home_url(); ?>
The home_url template tag retrieves the home URL of the current domain name of website.
ex: <a href="<?php echo home_url();">Home</a>
<?php echo get_template_directory_uri(); ?>
this function use to get the parent theme directory URI of current themese
eg:<img src="<?php echo get_template_directory_uri(); ?>/images/logo.png"/>
<?php wp_nav_menu(array()); ?>
this function is use to assigning menu on your themes.
ex: <?php wp_nav_menu( array( 'theme_location' => 'category_menu', 'menu_class' => 'nav-menu cate' ) ); ?>
go to see how to assign a menu in worpress themes.
<?php dynamic_sidebar( 'sidebar-2' ); ?>
This function is use to geting widget that you has been registered.
go to see how to register widget in wordpreses.

Share this acticle :

0 comments:

Post a Comment

 

Proudly powered by Blogger