Is it possible to stop a theme activation when a certain plugin is not activated

Using after_switch_theme will activate the theme (which is fine as we want to run the check within the context of the new theme). If the dependencies are not fulfilled ($missing_dependencies = true;) we’re instantly switching back to the theme previously used (passed via after_switch_theme and $oldtheme). add_action( ‘after_switch_theme’, ‘check_theme_dependencies’, 10, 2 ); function check_theme_dependencies( $oldtheme_name, … Read more

Why are my widgets not saving when being added to a sidebar?

Its the camel-case in the widget ID. The following works: add_action( ‘widgets_init’, ‘ditto_register_sidebars’ ); function ditto_register_sidebars() { register_sidebar(array( ‘name’ => __( ‘Right Hand Sidebar’ ), ‘id’ => ‘right-bar’, ‘description’ => __( ‘Widgets in this area will be shown on the right-hand side.’ ) )); } Per the Codex: id – Sidebar id – Must be … Read more

Can I Download a Free WordPress Theme, Edit it and Use it?

Yes. Use it. Edit it however you like. Redistribute it, modified or unmodified. Sell it. The GPL explicitly allows all of these things, provided that any such distribution is done also under GPL. While the GPL requires inline-documented author attribution and copyright/license information must remain intact, there is absolutely nothing wrong with removing public-facing “credit … Read more

Removing Shortcodes from Child Theme

Try this out. Remove the already added shortcode then add the new shortcode on the init hook. function shortcode_cleaner() { remove_shortcode( ‘entry-twitter-link’ ); // Not exactly required add_shortcode( ‘entry-twitter-link’, ‘my_remove_shortcode’ ); } add_action( ‘init’, ‘shortcode_cleaner’ ); function my_remove_shortcode(){ return ”; }

What are nulled themes?

Nulled theme basically mean cracked/hacked. The distributors of such themes often hide popups/ads inside to earn money, which you can’t see until a user complains about it or you check the website on google speed test for example where you see the image of the website, they aren’t secure at all, and it is not … Read more

WordPress generating 404 on .mp4 file in theme folder

Using get_template_directory_uri() or get_stylesheet_directory_uri() you can retrieve the url to your themes folder, and after that you just need to specify the path starting from there. Your code should look like this: <source src=”https://wordpress.stackexchange.com/questions/256580/<?php echo get_template_directory_uri() .”/assets/videos/videobg.mp4′; ?>” type=”video/mp4″>

Loading template files from a subfolder in my theme?

That part is extremely rigid, see this question about loading page templates from plugin directory. With current state of related code I would not bother spending time on this. Especially since you want it for convenience (putting template in sub-directories) and not functionality (like loading from plugin folder).

How do i structure my theme folder to avoid one huge list of files

Not a full answer, but I can at least answer this question: Also custom post template files can not be in sub directories. Everything, that you can load via get_template_part(), can reside in a subfolder: get_template_part( ‘subdir/part’, ‘suffix’ ); It’s as easy as that. Now you’ve your part inside ~/wp-content/themes/theme_folder/subdir/part-suffix.php Slightly off topic. Then there’re … Read more

How to incorporate admin theme in my back-end-plugin

Building admin interfaces in WordPress is quite ad hoc. Which is historical reason for many of those interface looking nothing like WP admin surrounding them. In general it works in terms of markup, rather than colors. You don’t code in terms of “black” or “red”, but in semantic terms like “primary” or “notification”. There are … Read more