Wordpres Help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • The Dawg
    Confirmed User
    • Apr 2002
    • 2438

    #1

    Wordpres Help

    On a custom category page how would you write:

    Code:
    if ($category->cat_ID == $this_category)
    I want to change the color of the category button IF it is the current category.
  • Colmike9
    (>^_^)b
    • Dec 2011
    • 7217

    #2
    Here's the syntax:
    http://codex.wordpress.org/Function_...t_the_category
    Join the BEST cam affiliate program on the internet!
    I've referred over $1.7mil in spending this past year, you should join in.
    I make a lot more money in the medical field in a lab now, fuck you guys. Don't ask me to come back, but do join Chaturbate in my sig, it still makes bank without me touching shit for years..

    Comment

    • mce
      Confirmed User
      • Jun 2012
      • 3915

      #3
      Anyone know if there are any CATEGORY-SPECIFIC ad rotator plugins?

      Pay Virtual Assistants Based on RESULTS instead of TIME
      STOP getting FUCKED IN THE ASS by your VA

      Comment

      • Colmike9
        (>^_^)b
        • Dec 2011
        • 7217

        #4
        Originally posted by mce
        Anyone know if there are any CATEGORY-SPECIFIC ad rotator plugins?
        Nah, just code it manually:

        <?php if ( is_category( 'CAT1') ): ?>
        <!-- Insert code for cat1 ad here -->
        CAT1 Code

        <?php elseif ( is_category( 'CAT2') ): ?>
        <!-- Insert code for cat2 ad here -->
        CAT2 Code

        <?php else: ?>
        <!-- Insert code for generic ad here -->
        Generic Ad Code

        <?php endif; ?>
        Join the BEST cam affiliate program on the internet!
        I've referred over $1.7mil in spending this past year, you should join in.
        I make a lot more money in the medical field in a lab now, fuck you guys. Don't ask me to come back, but do join Chaturbate in my sig, it still makes bank without me touching shit for years..

        Comment

        • The Dawg
          Confirmed User
          • Apr 2002
          • 2438

          #5
          Originally posted by Colmike7
          Yes, I found this too. My menu is loading with all the cats correctly. I want to add a the css code to change the current category to a different color.

          Comment

          • Colmike9
            (>^_^)b
            • Dec 2011
            • 7217

            #6
            Originally posted by The Dawg
            Yes, I found this too. My menu is loading with all the cats correctly. I want to add a the css code to change the current category to a different color.
            Hm, I'll have to think about that one. I can only think of doing that by overriding the text html based on the category by making a custom category list for the sidebar or maybe by using separate CSS files for each category using 'in_category' like this:


            <link rel="stylesheet" href="<?php bloginfo('template_url')?>/default.css" type="text/css" />

            <?php
            if( in_category( 1 ) )
            {
            ?>
            <link rel="stylesheet" href="<?php bloginfo('template_url')?>/cat1.css" type="text/css" />

            <?php } elseif ( in_category (2) )
            {
            ?>
            <link rel="stylesheet" href="<?php bloginfo('template_url')?>/cat2.css" type="text/css" />

            <?php } elseif ( in_category (3) )
            {
            ?>
            <link rel="stylesheet" href="<?php bloginfo('template_url')?>/cat3.css" type="text/css" />
            <?php } else { ?>

            <?php } ?>
            Join the BEST cam affiliate program on the internet!
            I've referred over $1.7mil in spending this past year, you should join in.
            I make a lot more money in the medical field in a lab now, fuck you guys. Don't ask me to come back, but do join Chaturbate in my sig, it still makes bank without me touching shit for years..

            Comment

            • mikesouth
              Confirmed User
              • Jun 2003
              • 6340

              #7
              adsponsors plugin from coyotesdesigns will do category specific ad rotation

              and its free
              Mike South

              It's No wonder I took up drugs and alcohol, it's the only way I could dumb myself down enough to cope with the morons in this biz.

              Comment

              • mce
                Confirmed User
                • Jun 2012
                • 3915

                #8
                Originally posted by mikesouth
                adsponsors plugin from coyotesdesigns will do category specific ad rotation

                and its free
                Thank you so much, Mikesouth and Colmike7

                Pay Virtual Assistants Based on RESULTS instead of TIME
                STOP getting FUCKED IN THE ASS by your VA

                Comment

                • The Dawg
                  Confirmed User
                  • Apr 2002
                  • 2438

                  #9
                  Originally posted by Colmike7
                  Hm, I'll have to think about that one. I can only think of doing that by overriding the text html based on the category by making a custom category list for the sidebar or maybe by using separate CSS files for each category using 'in_category' like this:


                  <link rel="stylesheet" href="<?php bloginfo('template_url')?>/default.css" type="text/css" />

                  <?php
                  if( in_category( 1 ) )
                  {
                  ?>
                  <link rel="stylesheet" href="<?php bloginfo('template_url')?>/cat1.css" type="text/css" />

                  <?php } elseif ( in_category (2) )
                  {
                  ?>
                  <link rel="stylesheet" href="<?php bloginfo('template_url')?>/cat2.css" type="text/css" />

                  <?php } elseif ( in_category (3) )
                  {
                  ?>
                  <link rel="stylesheet" href="<?php bloginfo('template_url')?>/cat3.css" type="text/css" />
                  <?php } else { ?>

                  <?php } ?>
                  Thanks.
                  Thats pretty long stuff there and I'd have to update it every time I added a new category. I got it to work a specific category ID:

                  Code:
                  <?php
                  $args=array(
                    'orderby' => 'name',
                    'order' => 'ASC'
                    );
                  $categories=get_categories($args);
                    foreach($categories as $category) {
                  if ($category->cat_ID == '4') {
                  echo '<p style="background-color:#eccad3;"><a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View %s Links" ), $category->name ) . '" ' . '>' . $category->name.'</a> </p> ';
                  }
                  else { echo '<p><a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View %s Links" ), $category->name ) . '" ' . '>' . $category->name.'</a> </p> '; }
                  }
                  ?>

                  Comment

                  • Colmike9
                    (>^_^)b
                    • Dec 2011
                    • 7217

                    #10
                    Originally posted by The Dawg
                    Thanks.
                    Thats pretty long stuff there and I'd have to update it every time I added a new category. I got it to work a specific category ID:

                    Code:
                    <?php
                    $args=array(
                      'orderby' => 'name',
                      'order' => 'ASC'
                      );
                    $categories=get_categories($args);
                      foreach($categories as $category) {
                    if ($category->cat_ID == '4') {
                    echo '<p style="background-color:#eccad3;"><a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View %s Links" ), $category->name ) . '" ' . '>' . $category->name.'</a> </p> ';
                    }
                    else { echo '<p><a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View %s Links" ), $category->name ) . '" ' . '>' . $category->name.'</a> </p> '; }
                    }
                    ?>
                    Nice
                    Join the BEST cam affiliate program on the internet!
                    I've referred over $1.7mil in spending this past year, you should join in.
                    I make a lot more money in the medical field in a lab now, fuck you guys. Don't ask me to come back, but do join Chaturbate in my sig, it still makes bank without me touching shit for years..

                    Comment

                    • fris
                      I have to go potty
                      • Aug 2002
                      • 55906

                      #11
                      Originally posted by The Dawg
                      On a custom category page how would you write:

                      Code:
                      if ($category->cat_ID == $this_category)
                      I want to change the color of the category button IF it is the current category.
                      Code:
                      echo get_category(get_query_var('cat'))->name;
                      will print out the current category name on the category.php page.
                      Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


                      My Newest Theme

                      Comment

                      Working...