setcookies and header send

The issue you have appears because you set your cookies too late. You have to set it before anything will be rendered. Set your cookies in the your-plugin-file.php file. Also you can check if headers were sent or not by calling headers_sent() function: add_action( ‘init’, ‘wpse8170_init’ ); function wpse8170_init() { if ( !headers_sent() ) { … Read more

Change appearance based on category but post is in two main categories

One easy way is to use has_category function. E.g. in your header you can use if ( has_category(‘pirtek’) ) { $header=”/path/to/pirtek/header” } else { $header=”/path/to/standard/header” } If the post has the ‘kirtek’ category, then the condition inside if is true, no matter what other categories the post belongs to. This kind of if statement can … Read more

Display custom widget value in header.php

The Codex is your friend. There’s a the_widget() function for that. <?php the_widget( ‘MY_Widget’, $instance, $args ); ?> Refer to the Codex entry for values for $instance and $args. $instance = array( ‘title’ => ‘Some Title here’, ‘name’ => ‘Some Name here’, ‘show_info’ => true ); $args = array( ‘before_widget’ => ”, // Your value … Read more

Export Header and Footer

I’m doing the same thing for my themes. I’m currently using twenty fourteen as a base for my child theme. What I do, I create 2 folders, namely css and functions. Say for instance I putting custom code in the footer, I will create a footerstyle.css in my css folder and a footer-functions.php in my … Read more

Fatal Error: get_header();

You can’t load template files directly. WordPress is not loaded in that context, so you have no access to its functions. Create a page in WordPress admin, and assign your template to that page, then point your link to that page rather than directly to the template file.

Theme modification for custom category menus

As indicated above, I discovered the answer to my own question. You do not need single quotes or brackets around the variable. The fact that the variable is a string itself is sufficient. The correct code is below: <?php $cat = get_the_category(); $catSlug = $cat[0]->slug; $catMenu = $catSlug . “-nav-menu”; $options = array( ‘container’=>’nav’, ‘container_class’=>’menu-header’, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)