How to Add WordPress Widgets in Post and Page Content

Widgets make it easy for users to simply drag and drop items into their WordPress site. Even though you can extend the power of default WordPress widgets, they are still limited to widget ready areas in your theme such as sidebars and footers. Wouldn’t it be nice if you could add widgets in your post or page content without writing a single line of code? Well, in this article, we will show you How to Add WordPress Widgets in Post and Page Content.

Add WordPress Widgets in Post and Page Content

First of all install and activate WordPress plugin i.e amr shortcode any widget. Once you activate the plugin, go to Appearance » Widgets. Next, drag and drop the widgets you want to display in your post or page into the Shortcodes sidebar.

Adding WordPress widgets in Post or Page content

Now those widgets are ready to be added to your content. Go to the post or page edit screen, and paste the following shortcode wherever you like in your content: [do_widget widgetname].

For example:

[do_widget calendar]

[do_widget pages]

If the widget name has space in it, then you need to add widget name in quotes like this:

[do_widget "recent posts"]

That’s it. Now you can add WordPress widgets in your post and page content. If you want to add a little more style to your widgets, then you might want to check out our article on how to make WordPress widgets colorful and less boring. Most widgets have titles, but if you don’t want to display them, then use this tutorial on how to hide widget titles.

Troubleshooting

If the widget does not show up in your content, then you need to use the widget id in the shortcode. First, make sure that you have added the right widget in the shortcodes sidebar, and you have added the shortcode with the widget name in your post or page. Publish that post/page and open it in a new browser window. Add the following string at the end of the page URL like this:

http://www.example.com/page-title/?do_widget_debug

It will show you debug information with widget IDs. Look for widget ids under the Shortcodes Sidebar.

Understanding get_template_part WordPress Function

If you’re creating WordPress themes you surely came across the get_template_part function at one point or another. It’s one of those hidden gems inside of WordPress that don’t get the attention they deserve. Let’s change that.

The get_template_part function is essentially a PHP include or require, on steroids:

  • It already knows where your theme is located and it will look for the requested file in that theme’s directory
  • It doesn’t issue a warning or fatal out if the requested file does not exist
  • It can search for other suitable files, if the requested one is not found
  • It knows about child themes and parent themes

Long story short, the get_template_part function allows you to break your theme down into smaller templates (or template parts), which can be reused across your other templates.

Although get_template_part is similar to a PHP include or require, you should not use it to include things like your theme options code, sidebars registration, custom widgets, etc. The get_template_part function should only be used to get template parts.

Let’s start off with some basic examples.

Basic Usage

Suppose we have a theme that has some post navigation elements above the post and below it. Let’s grab that and put it in a navigation.php file instead. Now, whenever we want to render our post navigation, all we would do is:

get_template_part( 'navigation' );

Which will load our navigation.php file if it exists. That’s fairly simple, right? Let’s add a little more spice to that. Since our post navigation goes above and below the post content, let’s add the second argument to get_template_part:

get_template_part( 'navigation', 'above' );
// post content goes here ...
get_template_part( 'navigation', 'below' );

The first call will look for navigation-above.php in our theme folder, and if that doesn’t exist, it will fall back to navigation.php. Similarly, the second call will look for navigation-below.php and fall back to navigation.php.

Pretty slick, eh? But the real power of get_template_part lies within the child themes model.

Child Themes

If you’re not familiar with the child themes model in WordPress, I strongly recommend you refer to the Codex. In a nutshell, a child theme may override the template files in your parent theme with their own, thus making modifications to the original theme without changing its source code or structure.

The get_template_part function plays quite an essential role in the child themes concept. Let’s go back to our first example from earlier:

get_template_part( 'navigation' );

As I already mentioned, this will look for a template file called navigation.php. However, if we’re in the child theme context, meaning a child theme is activated, such a call to get_template_part will look for navigation.php in our child theme first. If navigation.php is not found in our child theme, it will load the one in the parent theme. Makes sense?

Now comes the tricky part:

get_template_part( 'navigation', 'above' );

In a child theme context, this will look for the following templates in the following order:

  1. navigation-above.php in the child theme
  2. navigation-above.php in the parent theme
  3. navigation.php in the child theme
  4. navigation.php in the parent theme

The order is pretty important and something you should keep in mind.

Given this fallback model, it’s pretty common to use non hard-coded values withget_template_part in themes. For example:

get_template_part( 'navigation', get_post_type() );

Where get_post_type() will return the name of the post type that is currently shown, so if we’re on a Post, it’ll attempt to load navigation-post.php and fallback to navigation.php. If we’re on a Page, navigation-page.php and navigation.php. If we’re looking at a custom post type, say a Book, it will look for navigation-book.php and fall back to navigation.php.

A more common use case is post formats, with the post’s content area extracted into a template part of its own, like this:

get_template_part( 'content', get_post_format() );

Which will attempt to include content-gallery.php for gallery post formats, content-quote.php for quote post formats, and so on. If the particular file doesn’t exist, it will fall back to loading content.php. You can see this approach in action in the Twenty Eleven and Twenty Twelve themes.

Even if your theme does not include template files for all available post formats, it’s okay to follow this model, because a child theme might, and if it doesn’t, WordPress will just resort back to content.php.

Under the Hood

The real power of get_template_part comes from a function called locate_template, which does the whole searching in parent theme and child theme folders, and the reverting to other templates in a stack. The get_template_part function simply builds an array of templates for locate_template to look for. Here’s a quick example:

get_template_part( 'one', 'two' );

Creates an array of “one-two.php” and “one.php” (in that specific order) and passes it on to locate_template, which then loops through that array and looks for the files in the child and parent themes directories. The order is really important here, it’s kind of why file names have priority over their locations (parent theme or child theme) and explains the reason behind the lookup sequence.

It’s also worth noting, that functions such as get_headerget_sidebar andget_footer are very similar to get_template_part with a sort of hard-coded first argument.

At the time of writing, get_template_part is located in wp-includes/general-template.php and locate_template is in wp-includes/template.php.

Well, that’s about it folks! You should now be the master of the get_template_part voodoo, and now that you’re using it in your themes, you should get approximately 74% more sales. If you have any questions, go flood the comments. Take care!

 

This article originally appeared on www.kovshenin.com

 

CodeIgniter PHP MVC Framework

What is CodeIgniter?

CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications. If you’re a developer who lives in the real world of shared hosting accounts and clients with deadlines, and if you’re tired of ponderously large and thoroughly undocumented frameworks, then CodeIgniter might be a good fit.

CodeIgniter Is Right for You if…

  • You want a framework with a small footprint.
  • You need exceptional performance.
  • You need clear, thorough documentation.
  • You are not interested in large-scale monolithic libraries.
  • You need broad compatibility with standard hosting.
  • You prefer nearly zero configuration.
  • You don’t want to adhere to restrictive coding rules.
  • You don’t want to learn another template language.
  • You prefer simple solutions to complexity.
  • You want to spend more time away from the computer.

 

Best WordPress Resources

WordPress has become very popular over the past couple of years and today it powers more then 37% of sites on the Internet; no other content management system comes close to its widespread usage. It’s so robust that you can easily create just any type of website without spending much money as there are many best wordpress resources are available on the internet for free.

There are still a lot of people who don’t much about WordPress. So I thought, it might a good idea to assemble my favorite and best WordPress resources into a WordPress Handbook list that has everything all in one place for folks who are new in the WordPress land.

List of Best WordPress Resources

The land of WordPress is filled with a ton of WordPress blogs and constantly growing that it’s hard to stay on top of it. The following blogs are are filled with a good amount of useful tutorials & resources that will help you to stay up-to-date with WordPress.

  1. WP Beginner – Syed Balkhi runs the most popular unofficial tutorials blog for WordPress, where he provides tutorials, free videos and deals. Apart from running the beginner blog, Syed also speaks at various WordCamps.
  2. WP Daily – A great resource site to keep your mind updated with daily WordPress news. Run by the same guys who created 8bit and Standard theme.
  3. WPTuts+ – Owned by Envato Inc. and managed by WordPress evangelist Japh Thompson. This is a great resource and filled with a ton of detailed WordPress tutorials that you can’t afford to miss.
  4. WP Smashing Magazine – The blog doesn’t get update often but when it does the blog is filled with a great mix of tutorials & themes.
  5. WPMU – James Farmer run this popular multi-authors blog filled with advice on themes and plugins.
  6. CodePoet – An Automattic Contraption! Code Poet is a great resource for anyone building sites with WordPress.
  7. Tom Mcfarlin – This is a blog where Tom shares tutorials, tips & other useful resources.
  8. WP Hub – The blog recently come to light when Michael acquired WP Mods & merged it with already established WordPress resource, WP Hub.
  9. DigWP – The blog runs by two awesome guys – Chris Coyier and Jeff Starr. They have some excellent tutorials on improving your WordPress blog.
  10. WP Mayor – Another great WordPress blog with a lot of amazing content by Jean Gelena.
  11. WP Lift – WP Lift is brainchild of Oliver Dale. The blog includes tutorials, theme roundups, plugin guides and general news. With the recent redesign, the site looks like a useful resource.
  12. WP Explorer – One of the oldest WordPress blog with tons of freebies – themes, plugins & other useful stuff. The blog is owned and managed by AJ Clarke.
  13. WPSnipp – A collection of lot of useful snippets to help beginner & advance WordPress users.
  14. Yoast – Joost de Valk has a number of fantastic plugins & tutorials available on his blog.
  15. Justin Tadlock – Justin has some great and detailed tutorials on WordPress.
  16. Blondish.net – Blondish.net is run by Nile Flores, where she shares her knowledge on various topics such as plugin development, general tutorials, tips and blogging.
  17. WPEngine Blog – WPEngine runs an informative blog, where Austin Gunter shares his knowledge on optimizing websites and general opinions on WordPress.
  18. Jupiter Jims Marketing – Jim’s blog will help anyone who wants to build and market a WordPress site plus he has a ton of awesome tutorials on WordPress and the Thesis theme.
  19. Do it With WP – Dave has some interesting WordPress tutorials and snippets for beginner & advance users.
  20. BobWP – “Learn WordPress online with bobwp”… A fantastic blog full of WordPress tutorials, tips and videos.
  21. ManageWP Blog – Tips and how-to posts on effectively running and managing your WordPress blog.
  22. Paulund – Paul has a great collection of useful code snippets and WordPress tutorials.
  23. WP Kube – 2 years old blog managed by some random guy.

 

WordPress Information

Useful Information to help you learn more about WordPress.

  1. WordPress Codex – The  online manual for WordPress and a living repository for WordPress information and documentation.
  2. Make.WordPress –  This site is the home for official resources to help people develop for WordPress.
  3. WP 101 – The most affordable and fastest way to learn how to use WordPress!
  4. The 100 WordPress Related Blogs – A collection of 100 WordPress related blogs you need in your life.
  5. EasyWPGuide – An online & free downloadable manual for the how to do things with WordPress.
  6. iThemes Tutorials – iThemes has an amazing collection of useful WordPress tutorials. (thanksWalt for sharing ;) )

 

WordPress Books

These following WordPress books will give you detailed information on WordPress fundamentals and learn from the experts.

  1. Pro WordPress Design & Development – The book is packed with real-world examples for load balancing and multiusers, this esteemed resource replaces some of the more basic material with more advanced content.
  2. Pro WordPress Plugin Development – This comprehensive & professional development book shows you how plugins work, reviews the tools and APIs available in WordPress, and demonstrates how to extend the functionality of WordPress with plugins.
  3. WordPress for Dummies – This guide is written by Lisa Sabin-wilson and covers all the features and improvements in the most up-to-date version of WordPress.
  4. WordPress All in one for Dummies - Eight mini-books provide you with expanded coverage of the most important topics to the WordPress community, such as WordPress basics, theme designs, plug-in development, social media integration, SEO, customization, and running multiple sites.
  5. Digging Into WordPress – DigWP book is for beginners and intermediate users who want to learn it all and get the most out of WordPress. The book is available in both PDF and print version and is used by dozens of colleges and thousands of WP users.

WordPress Podcasts

Listening to some of the fantastic and finest WordPress Podcasts will not only give you the latest information and news, but will also help you in improve your site.

  1. Hello Dolly – Hello Dolly podcast started by the same guys who created some awesome products such as 8Bit, WPDaily StandardTheme, Team Science and soon to be launched Eve.io. Hello Dolly is one of the finest WordPress podcast available today. A few weeks ago, I even did a short interview with one of their co-founders – John Saddington.
  2. WPCandy Late Night – Started by Ryan Imel of WPCandy, they have some great stuff.
  3. PleaseAdvise.Fm –  An occasional WordPress podcast by Mike McAlister, Jake Caputo and Chris Molitor.
  4. DradCast – A couple of prior military geeks, a few adult beverages, and all things WordPress discussed. Although not limited to WordPress alone, the DradCast is a weekly video podcast that primarily concentrates on the latest news around WordPress. Started by two successful entrepreneurs – Brad Williams & Dre Armeda.
  5. Your Website Engineer (suggested by Ileane) – Dustin’s podcast is home to several WordPress tips and tutorials and he has more than 117 podcasts in his collection.

 

Popular Themes

There are a ton of WordPress theme shops, which makes it really hard to choose a quality theme. The following are the most popular and well established premium theme providers:

  1. StudioPress – Most of their themes are built on the fantastic theme framework – Genesis, the same framework that I am using here on WP Kube. They have a great collection of free & premium WordPress themes. Genesis is the framework that is used by hundreds of thousands of site owners. Here are few great resources for Genesis users:
    • The WP Chick – Kim Doyal has a lot of tutorials that span most areas newbies might need help with, from installing WordPress to using Genesis theme.
    • WP Smith – WPSmith features numerous quality content / tutorials that focus on Genesis.
  2. DIYThemes – Another great theme framework that I previously used to build sites on. Thesis is still a great theme framework and has ton of resources available. Useful resources for thesis – ThesisTut, Kolakube, ThesisAwesome and Themedy.
  3. Elegant Themes – If you’ve have been following me for a while now, than you know how much I love ElegantThemes. They have some of the best designs & well coded WordPress themes. For just $39.95 you get access to more then 77 application, magazine, ecommerce themes.
  4. ThemeForest – isn’t the place where I usually go for themes but they do have some great quality themes. One of my favorite theme is Lightly.
  5. ThemesKingdom – A premium theme shop where you can find awesome themes that are simple to use and customizable to fit your needs. They follows a somewhat similar model to ElegantThemes.
  6. WooThemes – What started with 3 people team has now become a international team of designers, developers and support ninjas catering for a passionate community of hundreds of thousands of users.
  7. Standard Theme – As the name suggests, it really is one of the most standard WordPress theme. The theme is also available for WordPress.com!
  8. CreativeMarket – A fantastic premium theme marketplace with 100% GPL license.

Essential Plugins

Following are the essential plugins that every WordPress blog needs to have. These plugins will not only going to help you improve your WordPress website, but also help you in getting more engagement and traffic.

  1. WordPress SEO by Yoast – This is a must have plugin for WordPress websites. Write better content and have a fully optimized WordPress site using this great plugin.
  2. Akismet GASP – The best anti-spam plugin that helps to fight a ton of spam comments. A lot of people in the comments recommended “GASP” to be the best anti spam plugin for WordPress. I think there are few reasons why Aksimet isn’t a great plugin because it catches a lot of spam comments and if you’re running a non-personal or business blog than you have to pay $5 / month.
  3. Backup Buddy – Want to wake one day seeing all your creative and hard work is gone? If your answer is no, then I have a great solution for you – Backup Buddy plugin, a powerful backup plugin for WordPress. It’s the same one that I uses for all my sites and recommend to everyone.
  4. Contact Form 7 – This is a great plugin for setting up a contact form without any efforts. It takes less then a minute to set up everything. If you’re looking for more then a contact form, than I would advice you to go with Gravity Forms.
  5. Sharebar – Add floating social media buttons to your WordPress site. It doesn’t much options unlike Digg Digg. Sharebar would only add the floating social media buttons.
  6. Subscribe to comments – Subscribe to Comments allows commentators to e-mail notifications for subsequent comments made on a blog post.
  7. nRelate Related Content – A plugin to showcase related posts at the bottom of every blog post. One of the best WordPress plugin in its class.
  8. W3 Total Cache – This plugin does a very good job of improving the speed of your WordPress site.
  9. Pretty link lite – I have tried a lot of premium affiliate management plugins including NinjaAffiliate, Pretty Link & Thirsty Affiliates and there is no better plugin than Pretty link lite as it doesn’t cost anything. If you have money then I would suggest you to either go with NinjaAffiliate or Thirsty Affiliates.
  10. SoliloquyWP – The plugin is packed with many incredible features that allows you to add a solid slider to your website.

WordPress Hosting

The following managed web hosts specialize in WordPress development and provide extensive support & are exclusive only to WordPress-powered sites.

  1. WP Engine – The Hassle free Managed web hosting for WordPress sites, the price starts at $29 / month and scales up to $249 for much larger blogs.
  2. Page.ly – Page.ly is a well known managed WordPress hosting provider and pricing starts at $24 / month.
  3. WebSynthesis – Owned by the CopyBlogger Media, the same guys who created Genesis Theme. The price starts at $27 / month.
  4. ZippyKid – Another great managed hosting for WordPress businesses and agencies with price $25 / month.
  5. BlogDroid – BlogDroid is managed WordPress hosting, served via their fast, secure and reliable hosting platform. The price starts at $25 / month for the first site.
  6. WordPress VIP -  The VIP hosting is used by big companies and pricing starts at $3,750 /month.

WordPress Tools & Services

The following tools and services will help you manage, monitor and improve your WordPress site or blog effectively with out spending much money.

  1. ManageWP – Manage multiple WordPress sites from a single dashboard and save a lot of your time. A great service with fantastic support.
  2. Sucuri – Premium security service that helps you keep your WordPress site secure from malwares & virus.
  3. VaultPress – An online protection & backup service by automattic. Their plans start at $15 / month.
  4. MaxCDN – CDN service that gives you the most powerful control panel at a very affordable price.
  5. PostStat.us – Post Status is a place to get the most interesting content available in the community in a very short amount of time. Created by Brian Krogsgard.
  6. WPMail.me -

This post is directly inspired by Neil Patel’s Handbook Resources. So a big thanks to Neil Patel ;) !

 

The post WordPress Handbook – 60+ Resources For First Time WordPress Users is originally written by Devesh and appeared first on WPKube