WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For example, in portfolio section I want to have 3 images that are positioned always in the same place in all the posts. I know there is a plugin that does this but I need to accomplish this without a plugin.

share|improve this question
up vote 3 down vote accepted

The best advice is to use the plugin. I can't think of any reason to rebuild functionality that already works well and exists. If you absolutely need this functionality in the theme, you can include the code from the plugin into your theme by removing the header in the plugin's main file and requiring it in your theme's functions.php file.

Please bear in mind that this is NOT considered as "best practice" and there are a couple of other steps that you will need to take to really make this work well:

  1. Change the name of all the functions. Adding a prefix like "myplugin_" to all functions should work well. Also, you will want to use this custom prefix on all global variables, class names, settings, localization slugs and anything else that WordPress might "see". This will avoid clashes in the event that the actual plugin is ever installed.

  2. load_plugin_textdomain() ahould be changed to load_theme_textdomain().

  3. plugins_url() will need to be changed to get_template_directory_uri().

  4. paths will need to be addressed.

At the end of the day, I would strongly urge you to allow your theme to support the plugin and degrade gracefully if the plugin is not installed.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.