• I am trying to set up a site that will basically be a merged version of five old blog style magazine sites. I want all the content to be on one site, but when visiting anything that falls under one of the categories for ‘magazine 1’, it is branded with all its logos. When magazine #2, it is branded with its logos.

    Any suggestions?

Viewing 9 replies - 1 through 9 (of 9 total)
  • first off, how do you determine which “magazine” they are going to?

    if you are differentiating them by category, it would be something similar to this:

    add_filter('template', 'magazine_style');
    add_filter('option_template', 'magazine_style');
    add_filter('option_stylesheet', 'magazine_style');
    
    function magazine_style($theme) {
      get_the_category();
    
      if ( in_category('Magazine A') ) {
        $theme="MagazineA";
      } elseif ( in_category ('Magazine B') ) {
        $theme="MagazineB";
      } elseif ( in_category ('Magazine C') ) {
        $theme="MagazineC";
      } else {
      }
      return $theme;
    }

    Thread Starter designsbyjf

    (@designsbyjf)

    Each Magazine would be a category. I would like to style all posts, category and sub-category pages for the living magazine to be styled with livingStyle.css and all that falls under the business magazine to be styled with businessStyle.css.

    Let me know if that is what you were trying to determine.

    Thread Starter designsbyjf

    (@designsbyjf)

    So, would I put this code in the category template file?

    you would have to put it in the functions.php file (you might have to put it in the functions.php file for EACH theme, in which case, you might have to check if it’s defined)

    if (!function_exists("magazine_style")) {
    function magazine_style($theme) {
      get_the_category();
    
      if ( in_category('Magazine A') ) {
        $theme="MagazineA";
      } elseif ( in_category ('Magazine B') ) {
        $theme="MagazineB";
      } elseif ( in_category ('Magazine C') ) {
        $theme="MagazineC";
      } else {
      }
      return $theme;
    }
    add_filter('template', 'magazine_style');
    add_filter('option_template', 'magazine_style');
    add_filter('option_stylesheet', 'magazine_style');
    
    }

    also, you might have to list each category individually (like sub-categories)

    $magazineAcats = array("Magazine A","headlines A", "TOC");
    $magazineBcats = array("Magazine B","headlines B", "Sporting Events");
    
    if (in_category($magazineAcats)) {

    also, if they all use the same theme, and you are just changing the .css file, there’s another albiet similar way to do it. let me know if that’s the direction you need.

    Thread Starter designsbyjf

    (@designsbyjf)

    that may be a better direction for me to go in. Could you please elaborate on this?

    same concept, only since there’s only 1 theme, you only need to put it in that theme’s functions.php file

    add_action('wp_head','magazine_style');
    function magazine_style() {
      global $post;  get_the_category();
    $magazineAcats = array("Magazine A","headlines A", "TOC");
    $magazineBcats = array("Magazine B","headlines B", "Sporting Events");
    
    if (in_category($magazineAcats)) { ?>
    <link rel="stylesheet" href="<?php bloginfo('template_url')?>/magazineA.css" type="text/css" />
    <? } else if (in_category($magazineBcats)) { ?>
    <link rel="stylesheet" href="<?php bloginfo('template_url')?>/MagazineB.css" type="text/css" />
    <? } else { ?>
    <link rel="stylesheet" href="<?php bloginfo('template_url')?>/style.css" type="text/css" />
    <? }}?>

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Create On Site with Multiple Styles’ is closed to new replies.