How to add wordpress plugins in along with my standalone theme

You can use TGM Plugin Activation library to let the user know about required and recommended plguins that your theme depends on. Automatically installing plugins is not a better choice instead let the users know that X plugin should be installed and activated in order for the theme to work properly. If your theme requires … Read more

wp_nav_menu custom walker class

You can try to alter the $attributes string, since that outputs the attributes in the a tag. The following is untested: $myClass=”some-custom-class”; $myClassAdded = false; $attributes=””; foreach ( $atts as $attr => $value ) { if ( ! empty( $value ) ) { $value = ( ‘href’ === $attr ) ? esc_url( $value ) : … Read more

Can I use WP Multi-site on a sub-domain with a different theme but use all the original site’s posts/pages?

Here’s an example of a solution I configured, which leaves the site in the network, but establishes a domain map from any registered domain, to the network. It makes the network site appear to be a completely independent site, with all the functionality (log-in, etc.) intact. Goal: Map client’s registered domain, both www.foosite.com and foosite.com … Read more

image sizes – finding and removing

By default WP support 3 image sizes ie Thumbnail, Medium and Large. If you want to remove any of these then you can use a filter “intermediate_image_sizes_advanced” to remove the default image sizes. function wp_remove_default_image_sizes( $sizes ) { unset( $sizes[‘thumbnail’] ); // remove thumbnail support unset( $sizes[‘medium’] ); // remove medium support unset( $sizes[‘large’] ); … Read more

Calling PHP function doesn’t work in index.php

I think you’re misunderstanding the function get_page_template_slug When you call $template = get_page_template_slug( $post_id ); it won’t return index.php if you are using the default theme template. It only works when viewing Pages and will either return the slug of the Custom Page Template assigned to that Page or an empty string otherwise. So if … Read more