Fatal error: Cannot redeclare when switching themes

The CSS for my parent theme (core) was incorrectly formatted. The code at the top read: Theme Name: Core Theme URI: http://www.domain.co.uk Description: The core theme. Author: Squideyes Author URI: http://www.domain.co.uk Template: Core Version: 1.0.0 Tags: clean, simple, easy The Template: tag should only appear in the child theme css. This is what caused the … Read more

Make parent page only link to first subpage

class Themeslug_Page_Navigation_Walker extends Walker_Nav_Menu { function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, &$output ) { $id_field = $this->db_fields[‘id’]; if ( !empty( $children_elements[ $element->$id_field ] ) ) { $element->url = $children_elements[$element->$id_field][0]->url; } Walker_Nav_Menu::display_element( $element, $children_elements, $max_depth, $depth, $args, $output ); } } This did the trick.

Right way to update widget on dynamic new input field

Ok, i have solvd it, there is my updated code <?php /** * Adds TMD_Radio_Player. */ class TMD_Radio_Player extends WP_Widget { /** * Register widget with WordPress. */ function __construct() { parent::__construct( ‘tmd_radio_player’, // Base ID __(‘TMD Radio Player’, ‘text_domain’), // Name array( ‘description’ => __( ‘Menampilkan radio player’, ‘text_domain’ ), ) // Args ); … Read more

Stuck on maintenance mode

Since you are using the W3 total cache plugin, So The HTML code will be cached in the wp-content/cache folder. So Delete Cache folder from wp-content directory. Now remove the function activate_maintenance_mode() and check the site now… If the problem exists , Delete the W3 total Cache Constant from wp-config.php and clear your browser data … Read more

Child theme within a child theme?

You can add a custom functions.php to your child theme. As long as it’s in the child theme folder, it will not be overwritten when you update the parent theme. See http://codex.wordpress.org/Child_Themes. Read the section “Using functions.php”

How do I add Bootstrap and LESS to my migrated WordPress site?

You don’t need to create additional functions, just re-use what you already have and tweak it a bit: function theme_add_bootstrap() { wp_enqueue_style( ‘bootstrap-css’, get_template_directory_uri() . ‘/third_party/bootstrap/css/bootstrap.min.css’ ); wp_enqueue_script( ‘bootstrap-js’, get_template_directory_uri() . ‘/third_party/bootstrap/js/bootstrap.min.js’, array(), ‘3.0.0’, true ); if (WP_ENV === ‘development’) { wp_enqueue_script( ‘lesscss’, get_stylesheet_directory_uri() . ‘/third_party/less-1.5.0.min.js’ ); wp_enqueue_style( ‘style-less’, get_template_directory_uri() . ‘/css/custom.less’ ); } else … Read more

translate the_title() with .po & .mo

Since, ‘the_title()’ is not a static word, you can’t directly translate it. Its value can be dynamic and saved in the database. So, you can either use plugins like ‘WPML’, ‘qTranslate’ or just learn how to do translation for the values which are saved in database.