GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Wordpres Help (https://gfy.com/showthread.php?t=1076396)

The Dawg 07-30-2012 03:21 PM

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 07-30-2012 03:26 PM

Here's the syntax:
http://codex.wordpress.org/Function_...t_the_category

mce 07-30-2012 03:27 PM

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

Colmike9 07-30-2012 03:30 PM

Quote:

Originally Posted by mce (Post 19093337)
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; ?>
:upsidedow

The Dawg 07-30-2012 03:31 PM

Quote:

Originally Posted by Colmike7 (Post 19093333)

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.

Colmike9 07-30-2012 03:36 PM

Quote:

Originally Posted by The Dawg (Post 19093343)
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 } ?>

mikesouth 07-30-2012 03:40 PM

adsponsors plugin from coyotesdesigns will do category specific ad rotation

and its free

mce 07-30-2012 03:45 PM

Quote:

Originally Posted by mikesouth (Post 19093361)
adsponsors plugin from coyotesdesigns will do category specific ad rotation

and its free

Thank you so much, Mikesouth and Colmike7

The Dawg 07-30-2012 03:59 PM

Quote:

Originally Posted by Colmike7 (Post 19093349)
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> '; }
}
?>


Colmike9 07-30-2012 04:15 PM

Quote:

Originally Posted by The Dawg (Post 19093388)
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 :thumbsup

fris 07-30-2012 05:08 PM

Quote:

Originally Posted by The Dawg (Post 19093324)
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.


All times are GMT -7. The time now is 11:31 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123