Theme and Plugins sharing common libraries

Can a theme or plugin go and fetch another plugin and install it? For themes, it’s rather straighforward. See https://github.com/thomasgriffin/TGM-Plugin-Activation For plugins, it’s trickier, since you can’t bundle the same boilerplate code in more than one plugin. See http://wordpress.org/extend/plugins/plugin-dependencies/

file_get_contents Not allowed in Themes?

Line 49: $data = file_get_contents ( ‘http://example.com’); Don’t use file_get_contents to download web page. WordPress has HTTP API for such needs. In your case, I would suggest you to use wp_remote_get( ‘http://example.com’ ); function instead of file_get_contents. Further reading: WordPress HTTP API wp_remote_get function.

Add social icons in a theme through custom admin menu

I did something similar on my site a while back. I’m sure you can tweak it to fit your needs. Under each article I have an author box with social media icons that link to their accounts. In content-single.php <?php if ( get_the_author_meta(‘twitter’) ) : ?> <a href=”http://www.twitter.com/<?php the_author_meta(‘twitter’); ?>” title=”Twitter”><img src=”<?php bloginfo( ‘url’ ) … Read more

Child-theme breaks site

Your parent theme is probably broken. I guess it is using code like this: require_once get_stylesheet_directory() . ‘/admin/options-framework.php’; So it will search in the child theme for files that are present in the parent theme only. It should use get_template_directory() instead.

Setting a Default ‘Theme Location’ When Creating a Menu

You need to first collect the menu locations, then set the primary menu location with the menu id. // Set the menu to primary menu location $locations = get_theme_mod( ‘nav_menu_locations’ ); $locations[‘primary’] = $primary_nav_menu_id; set_theme_mod ( ‘nav_menu_locations’, $locations ); Here I assume ‘primary’ is theme location referring to ‘Primary Navigation’.

Passing array in add_option()

I think that you have added bguru_options option before. If bguru_options already exists, add_option() does nothing. To modify the value of existing options you should use update_option() instead. EDIT I confirm what I thought. You are running add_option(‘bguru_options’, $default_options); in every admin_init. bguru_options option was added to database in the first run and subsequent calls … Read more

Changing the title of post with code

Your question isn’t terribly clear, because, yes it is possible to change post data programmatically, and you’re on the right track using wp_update_post, but I’m unsure of what the code in your theme’s index.php file is trying to achieve. My assumption is that you want to be able to change the post title from your … Read more