How to add a second stylesheet to the editor
Yes! Any .css file in the top-level of your theme will show up there. e.g.: /wp-content/themes/<your-theme>/custom-style.css will show up in that list as “custom-style.css”, linked and editable.
Yes! Any .css file in the top-level of your theme will show up there. e.g.: /wp-content/themes/<your-theme>/custom-style.css will show up in that list as “custom-style.css”, linked and editable.
I use this functions. First of all, you have to add some custom class to your menu item (allow class input in Screen options, it’s not visible by default). function mark_menu_item_as_active($classes, $item) { if( in_array(‘my-custom-class’,$classes) && ( is_category(‘my-category’) /* OR …*/ ) ) { $classes[] = ‘current-menu-item’; } return $classes; } add_filter(‘nav_menu_css_class’, ‘mark_menu_item_as_active’, 10, 2); … Read more
You can do it by targeting get_option(‘show_on_front’); some code which could help would be: function themename_after_setup_theme() { $site_type = get_option(‘show_on_front’); if($site_type == ‘posts’) { update_option( ‘show_on_front’, ‘page’ ); update_option( ‘page_for_posts’, ‘page-name’ ); } } add_action( ‘after_setup_theme’, ‘themename_after_setup_theme’ ); This will run on theme activation only, remember to change the page-name to the page you want … Read more
You can use below code for translating strings: add_filter(‘gettext’, ‘translate_text’); add_filter(‘ngettext’, ‘translate_text’); function translate_text($translated) { $translated = str_ireplace(‘Choose an option’, ‘Select’, $translated); $translated = str_ireplace(‘Original Text’, ‘Your Replacment Text’, $translated); return $translated; } But I have no idea for translating complex contents. I know you don’t want to use plugins but as my research, we … Read more
Add this in your functions.php if( !function_exists( ‘my_custom_widgetize_theme’ ) ){ add_action ( ‘after_setup_theme’, ‘my_custom_widgetize_theme’, 10 ); function my_custom_widgetize_theme(){ register_sidebar(array( ‘name’ => ‘My SideBar’, ‘id’ => ‘my_sidebar’, ‘description’ => ‘This is the widgetized Side Bar.’, ‘before_widget’ => ‘<div id=”%1$s” class=”widget %2$s”>’, ‘after_widget’ => ‘</div>’, ‘before_title’ => ‘<h4>’, ‘after_title’ => ‘</h4>’ )); } } //this will be … Read more
If you have a LESS version of Bootstrap (non-compiled) you need to change the @grid-float-breakpoint variable to 992px to get the navbar to collapse on “Tablet” (Medium) breakpoint. Source: Changing the collapsed mobile navbar breakpoint The navbar collapses into its vertical mobile view when the viewport is narrower than @grid-float-breakpoint, and expands into its horizontal … Read more
No, they don’t need. They will need to go through the approval process of the marketplace where you will sell them (if any).
It really just depends on what you need to do here. The general method is to hook all your theme support features to after_setup_theme for some obvious reasons. after_setup_theme is the first action hook available to themes to add any type of support the theme. Certain features has to be registered here and cannot be … Read more
Yes, this is supported. They’re called panels, sections and controls. Adding a panel uses this code: $wp_customize->add_panel( $panel_name, array( ‘title’ => ‘panel_title’, ‘description’ => ‘panel_description’, ‘priority’ => ‘priority’, ‘capability’ => ‘edit_theme_options’, ‘theme_supports’ => ” )); Adding a section goes like this: $wp_customize->add_section($section_name , array( ‘panel’ => ‘panel_name’, ‘title’ => ‘section_title’, ‘description’ => ‘section_description’, ‘priority’ => … Read more
Although @Jevuska did solve my issue, I have found a much easier solution to adding dynamic CSS from my theme options page. Here we go! Add this to functions.php add_action(‘wp_head’, ‘my_custom_css’); function my_custom_css(){ require_once( get_template_directory() . ‘/css/theme-styles.php’ ); } Now you can treat theme-styles.php as a normal CSS stylesheet <style type=”text/css”> a { color: <?php … Read more