Skip to main content
replaced http://wordpress.stackexchange.com/ with https://wordpress.stackexchange.com/
Source Link

Possible Duplicate:
is_singular won’t call my functions?is_singular won’t call my functions?

So I am trying to call different style sheets for each of my post types single page.

Here is the code I am using in my header file.

<?php
if ( ! is_home() ) {

if ( is_single() == 'pretty-little-liars' )  {
echo '<link rel="stylesheet" href="http://www.tv-cafe.com/wp-content/themes/tvcafe/posttypecss/style-pll.css" type="text/css" media="screen" />';
}
if ( is_single() == 'revenge' )  {
echo '<link rel="stylesheet" href="http://www.tv-cafe.com/wp-content/themes/tvcafe/posttypecss/style-revenge.css" type="text/css" media="screen" />';
}
if ( is_single() == 'once-upon-a-time' )  {
echo '<link rel="stylesheet" href="http://www.tv-cafe.com/wp-content/themes/tvcafe/posttypecss/style-onceuponatime.css" type="text/css" media="screen" />';
}
}
?>

and I also learned that I had to add this code in my functions.php in order for it to work properly

add_action( 'wp_enqueue_scripts', 'wpse78368_enqueue_custom_stylesheet' );
function wpse78368_enqueue_custom_stylesheet() {
if ( is_single( 'pretty-little-liars' ) ) {
    wp_enqueue_style( 'style-pll', get_template_directory_uri() . '/posttypecss/style-pll.css' );
}
 if ( is_single( 'revenge' ) ) {
    wp_enqueue_style( 'style-revenge', get_template_directory_uri() . '/posttypecss/style-revenge.css' );
}
if ( is_single( 'once-upon-a-time' ) ) {
    wp_enqueue_style( 'style-onceuponatime', get_template_directory_uri() . '/posttypecss/style-onceuponatime.css' );
}
}

But the problem is that, the code is calling the last stylesheet of the code. It is calling the "Once Upon A Time" stylesheet for each custom post type singular page.

How can I fix this?

Possible Duplicate:
is_singular won’t call my functions?

So I am trying to call different style sheets for each of my post types single page.

Here is the code I am using in my header file.

<?php
if ( ! is_home() ) {

if ( is_single() == 'pretty-little-liars' )  {
echo '<link rel="stylesheet" href="http://www.tv-cafe.com/wp-content/themes/tvcafe/posttypecss/style-pll.css" type="text/css" media="screen" />';
}
if ( is_single() == 'revenge' )  {
echo '<link rel="stylesheet" href="http://www.tv-cafe.com/wp-content/themes/tvcafe/posttypecss/style-revenge.css" type="text/css" media="screen" />';
}
if ( is_single() == 'once-upon-a-time' )  {
echo '<link rel="stylesheet" href="http://www.tv-cafe.com/wp-content/themes/tvcafe/posttypecss/style-onceuponatime.css" type="text/css" media="screen" />';
}
}
?>

and I also learned that I had to add this code in my functions.php in order for it to work properly

add_action( 'wp_enqueue_scripts', 'wpse78368_enqueue_custom_stylesheet' );
function wpse78368_enqueue_custom_stylesheet() {
if ( is_single( 'pretty-little-liars' ) ) {
    wp_enqueue_style( 'style-pll', get_template_directory_uri() . '/posttypecss/style-pll.css' );
}
 if ( is_single( 'revenge' ) ) {
    wp_enqueue_style( 'style-revenge', get_template_directory_uri() . '/posttypecss/style-revenge.css' );
}
if ( is_single( 'once-upon-a-time' ) ) {
    wp_enqueue_style( 'style-onceuponatime', get_template_directory_uri() . '/posttypecss/style-onceuponatime.css' );
}
}

But the problem is that, the code is calling the last stylesheet of the code. It is calling the "Once Upon A Time" stylesheet for each custom post type singular page.

How can I fix this?

Possible Duplicate:
is_singular won’t call my functions?

So I am trying to call different style sheets for each of my post types single page.

Here is the code I am using in my header file.

<?php
if ( ! is_home() ) {

if ( is_single() == 'pretty-little-liars' )  {
echo '<link rel="stylesheet" href="http://www.tv-cafe.com/wp-content/themes/tvcafe/posttypecss/style-pll.css" type="text/css" media="screen" />';
}
if ( is_single() == 'revenge' )  {
echo '<link rel="stylesheet" href="http://www.tv-cafe.com/wp-content/themes/tvcafe/posttypecss/style-revenge.css" type="text/css" media="screen" />';
}
if ( is_single() == 'once-upon-a-time' )  {
echo '<link rel="stylesheet" href="http://www.tv-cafe.com/wp-content/themes/tvcafe/posttypecss/style-onceuponatime.css" type="text/css" media="screen" />';
}
}
?>

and I also learned that I had to add this code in my functions.php in order for it to work properly

add_action( 'wp_enqueue_scripts', 'wpse78368_enqueue_custom_stylesheet' );
function wpse78368_enqueue_custom_stylesheet() {
if ( is_single( 'pretty-little-liars' ) ) {
    wp_enqueue_style( 'style-pll', get_template_directory_uri() . '/posttypecss/style-pll.css' );
}
 if ( is_single( 'revenge' ) ) {
    wp_enqueue_style( 'style-revenge', get_template_directory_uri() . '/posttypecss/style-revenge.css' );
}
if ( is_single( 'once-upon-a-time' ) ) {
    wp_enqueue_style( 'style-onceuponatime', get_template_directory_uri() . '/posttypecss/style-onceuponatime.css' );
}
}

But the problem is that, the code is calling the last stylesheet of the code. It is calling the "Once Upon A Time" stylesheet for each custom post type singular page.

How can I fix this?

insert duplicate link
Source Link

Possible Duplicate:
is_singular won’t call my functions?

So I am trying to call different style sheets for each of my post types single page.

Here is the code I am using in my header file.

<?php
if ( ! is_home() ) {

if ( is_single() == 'pretty-little-liars' )  {
echo '<link rel="stylesheet" href="http://www.tv-cafe.com/wp-content/themes/tvcafe/posttypecss/style-pll.css" type="text/css" media="screen" />';
}
if ( is_single() == 'revenge' )  {
echo '<link rel="stylesheet" href="http://www.tv-cafe.com/wp-content/themes/tvcafe/posttypecss/style-revenge.css" type="text/css" media="screen" />';
}
if ( is_single() == 'once-upon-a-time' )  {
echo '<link rel="stylesheet" href="http://www.tv-cafe.com/wp-content/themes/tvcafe/posttypecss/style-onceuponatime.css" type="text/css" media="screen" />';
}
}
?>

and I also learned that I had to add this code in my functions.php in order for it to work properly

add_action( 'wp_enqueue_scripts', 'wpse78368_enqueue_custom_stylesheet' );
function wpse78368_enqueue_custom_stylesheet() {
if ( is_single( 'pretty-little-liars' ) ) {
    wp_enqueue_style( 'style-pll', get_template_directory_uri() . '/posttypecss/style-pll.css' );
}
 if ( is_single( 'revenge' ) ) {
    wp_enqueue_style( 'style-revenge', get_template_directory_uri() . '/posttypecss/style-revenge.css' );
}
if ( is_single( 'once-upon-a-time' ) ) {
    wp_enqueue_style( 'style-onceuponatime', get_template_directory_uri() . '/posttypecss/style-onceuponatime.css' );
}
}

But the problem is that, the code is calling the last stylesheet of the code. It is calling the "Once Upon A Time" stylesheet for each custom post type singular page.

How can I fix this?

So I am trying to call different style sheets for each of my post types single page.

Here is the code I am using in my header file.

<?php
if ( ! is_home() ) {

if ( is_single() == 'pretty-little-liars' )  {
echo '<link rel="stylesheet" href="http://www.tv-cafe.com/wp-content/themes/tvcafe/posttypecss/style-pll.css" type="text/css" media="screen" />';
}
if ( is_single() == 'revenge' )  {
echo '<link rel="stylesheet" href="http://www.tv-cafe.com/wp-content/themes/tvcafe/posttypecss/style-revenge.css" type="text/css" media="screen" />';
}
if ( is_single() == 'once-upon-a-time' )  {
echo '<link rel="stylesheet" href="http://www.tv-cafe.com/wp-content/themes/tvcafe/posttypecss/style-onceuponatime.css" type="text/css" media="screen" />';
}
}
?>

and I also learned that I had to add this code in my functions.php in order for it to work properly

add_action( 'wp_enqueue_scripts', 'wpse78368_enqueue_custom_stylesheet' );
function wpse78368_enqueue_custom_stylesheet() {
if ( is_single( 'pretty-little-liars' ) ) {
    wp_enqueue_style( 'style-pll', get_template_directory_uri() . '/posttypecss/style-pll.css' );
}
 if ( is_single( 'revenge' ) ) {
    wp_enqueue_style( 'style-revenge', get_template_directory_uri() . '/posttypecss/style-revenge.css' );
}
if ( is_single( 'once-upon-a-time' ) ) {
    wp_enqueue_style( 'style-onceuponatime', get_template_directory_uri() . '/posttypecss/style-onceuponatime.css' );
}
}

But the problem is that, the code is calling the last stylesheet of the code. It is calling the "Once Upon A Time" stylesheet for each custom post type singular page.

How can I fix this?

Possible Duplicate:
is_singular won’t call my functions?

So I am trying to call different style sheets for each of my post types single page.

Here is the code I am using in my header file.

<?php
if ( ! is_home() ) {

if ( is_single() == 'pretty-little-liars' )  {
echo '<link rel="stylesheet" href="http://www.tv-cafe.com/wp-content/themes/tvcafe/posttypecss/style-pll.css" type="text/css" media="screen" />';
}
if ( is_single() == 'revenge' )  {
echo '<link rel="stylesheet" href="http://www.tv-cafe.com/wp-content/themes/tvcafe/posttypecss/style-revenge.css" type="text/css" media="screen" />';
}
if ( is_single() == 'once-upon-a-time' )  {
echo '<link rel="stylesheet" href="http://www.tv-cafe.com/wp-content/themes/tvcafe/posttypecss/style-onceuponatime.css" type="text/css" media="screen" />';
}
}
?>

and I also learned that I had to add this code in my functions.php in order for it to work properly

add_action( 'wp_enqueue_scripts', 'wpse78368_enqueue_custom_stylesheet' );
function wpse78368_enqueue_custom_stylesheet() {
if ( is_single( 'pretty-little-liars' ) ) {
    wp_enqueue_style( 'style-pll', get_template_directory_uri() . '/posttypecss/style-pll.css' );
}
 if ( is_single( 'revenge' ) ) {
    wp_enqueue_style( 'style-revenge', get_template_directory_uri() . '/posttypecss/style-revenge.css' );
}
if ( is_single( 'once-upon-a-time' ) ) {
    wp_enqueue_style( 'style-onceuponatime', get_template_directory_uri() . '/posttypecss/style-onceuponatime.css' );
}
}

But the problem is that, the code is calling the last stylesheet of the code. It is calling the "Once Upon A Time" stylesheet for each custom post type singular page.

How can I fix this?

Post Closed as "exact duplicate" by fuxia
Source Link
Mihad Aiko
  • 181
  • 4
  • 15

is_single query calling the wrong stylesheets?

So I am trying to call different style sheets for each of my post types single page.

Here is the code I am using in my header file.

<?php
if ( ! is_home() ) {

if ( is_single() == 'pretty-little-liars' )  {
echo '<link rel="stylesheet" href="http://www.tv-cafe.com/wp-content/themes/tvcafe/posttypecss/style-pll.css" type="text/css" media="screen" />';
}
if ( is_single() == 'revenge' )  {
echo '<link rel="stylesheet" href="http://www.tv-cafe.com/wp-content/themes/tvcafe/posttypecss/style-revenge.css" type="text/css" media="screen" />';
}
if ( is_single() == 'once-upon-a-time' )  {
echo '<link rel="stylesheet" href="http://www.tv-cafe.com/wp-content/themes/tvcafe/posttypecss/style-onceuponatime.css" type="text/css" media="screen" />';
}
}
?>

and I also learned that I had to add this code in my functions.php in order for it to work properly

add_action( 'wp_enqueue_scripts', 'wpse78368_enqueue_custom_stylesheet' );
function wpse78368_enqueue_custom_stylesheet() {
if ( is_single( 'pretty-little-liars' ) ) {
    wp_enqueue_style( 'style-pll', get_template_directory_uri() . '/posttypecss/style-pll.css' );
}
 if ( is_single( 'revenge' ) ) {
    wp_enqueue_style( 'style-revenge', get_template_directory_uri() . '/posttypecss/style-revenge.css' );
}
if ( is_single( 'once-upon-a-time' ) ) {
    wp_enqueue_style( 'style-onceuponatime', get_template_directory_uri() . '/posttypecss/style-onceuponatime.css' );
}
}

But the problem is that, the code is calling the last stylesheet of the code. It is calling the "Once Upon A Time" stylesheet for each custom post type singular page.

How can I fix this?