Last active
December 8, 2017 06:03
-
-
Save humayunahmed8/8eee0c5d7fd976ce0ac03c069879312e to your computer and use it in GitHub Desktop.
Basic function for wordpress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Dynamic font awesome icon | |
========================== | |
<div class="icon"> | |
<i class="fa fa-<?php echo get_post_meta($post->ID,'s_icon',true); ?>"></i> | |
</div> | |
2. WP trim words | |
========================== | |
<?php wp_trim_words( $text, $num_words = 55, $more = null ); ?> | |
<?php echo wp_trim_words( get_the_content(), 40, '...' ); ?> | |
Usage of Trim words | |
******************** | |
<p class="entry-comtent"><?php echo wp_trim_words(get_the_content(),40); ?><a href="<?php the_permalink(); ?>" class="more- link">Read More...</a></p> | |
3. WP body class | |
========================== | |
<body <?php body_class();?>> | |
4. SEO friendly dynamic title | |
============================= | |
<title> | |
<?php if (is_single() || is_page()) { wp_title('',true); } elseif(is_front_page()) { bloginfo('description'); } else { bloginfo('description'); } ?> | <?php bloginfo('name');?> | |
</title> | |
5. WP Language Attributes | |
============================== | |
<html <?php language_attributes(); ?>> | |
6. Dynamic Header | |
============================== | |
<?php wp_head();?> | |
7. Dynmaic Footer | |
============================== | |
<?php get_footer();?> | |
8. Dynmic Sidebar | |
============================== | |
<?php get_sidebar(); ?> | |
9. Dynamic logo and custom header | |
================================== | |
<a class="navbar-brand" href="<?php echo home_url(); ?>"><img src="<?php header_image(); ?>" height="<?php echo get_custom_header()->height; ?>" width="<?php echo get_custom_header()->width; ?>" alt="" /></a> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment