Activate plugins by a theme’s functions.php?

Write This Code On theme Function.php function run_activate_plugin( $plugin ) { $current = get_option( ‘active_plugins’ ); $plugin = plugin_basename( trim( $plugin ) ); if ( !in_array( $plugin, $current ) ) { $current[] = $plugin; sort( $current ); do_action( ‘activate_plugin’, trim( $plugin ) ); update_option( ‘active_plugins’, $current ); do_action( ‘activate_’ . trim( $plugin ) ); do_action( … Read more

two body tags on all WP pages regardless of theme

I think this is the browser modifying the DOM due to a weird character you have in your body tag. When I view source in Firefox, I’m seeing the “character not recognized” box next to the body tag. This is also visible in Firefox inspector. Modern browsers automatically fix issues in your HTML for you … Read more

Display read only info on admin, custom post page

add_action( ‘edit_form_after_title’, ‘my_edit_form_after_title’); function my_edit_form_after_title($post) { $post_types = array( ‘page’ ); // post type / s $templates = array( ‘template-custom.php’ ); // not edit 😀 if( !in_array( $post->post_type, $post_types) ) return; if( !in_array( get_page_template_slug(), $templates) ) return; global $_wp_post_type_features; foreach ($post_types as $post_type) { if( isset($_wp_post_type_features[ $post_type ][‘editor’]) ) { unset($_wp_post_type_features[ $post_type ][‘editor’]); // we … Read more

Problem to asign class to with wp_nav_menu()

Make sure your menu does setup correctly in that location in Appearance / Menus, unless it wont display that class. After you set the theme location to Primary Menu, it should work fine. No idea why, guess its a bug in WordPress. Also fix the typo: ‘container’ => false

Replace TinyMCE with Custom Built Editor

You can do that with js/jquery if you want : $(‘#postdivrich’).hide().after(your custom editor div); You can add inputs with jquery and save them with : add_action(‘save_post’, ‘save_the_post’); function save_the_post(){ global $post; update_post_meta($post->ID, ‘field_name’, $_POST[‘field_name’]); } Or use a metabox and replace standard editor with it (width jquery). Hope this help someone 🙂

style css to header for shortcodes

You can insert any code in the header by hooking an action. header.php <?php wp_head(); ?> functions.php add_action( ‘wp_head’, ‘iulia_example’ ); function iulia_example() { echo ‘<style type=”text/css”> .sc_title {color:#fff; font-weight:600;} </style>’; } the result will be : the style inserted just above </head>