Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Forum: Hacks
    In reply to: addclass to related posts
    Thread Starter gerbsi

    (@gerbsi)

    I found som examples which i started to play with. Although I dont know if im on the right way.
    Now im getting this error:
    Argument #1 is not an array in footer.php .

    This is how overview.php looks like

    while( $myQuery->have_posts() ) :
    						    $myQuery->the_post();
    							$categoriesOverview = array();
    							foreach( get_the_category() as $cat ) {
    							$categoriesOverview[] = $cat->name  ;
    							}

    then in footer.php

    while( $myQuery->have_posts() ) : $myQuery->the_post();
    							$categoriesArchive = array();
    							foreach( get_the_category() as $cat ) {
    							$categoriesArchive[] = $cat->name  ;
    							}
    						   $result = array_intersect($categoriesOverwiev, $categoriesArchive);
    						   echo $result;

    Forum: Hacks
    In reply to: addclass to related posts
    Thread Starter gerbsi

    (@gerbsi)

    Hey,

    thanks for the answer — Im still a bit lost (quite new to php and wordpress, or i dont really understand how i can save all cat IDs in an array then compare it to the archive loop. Could you help me or do you know where i can read about it?

    Best

Viewing 2 replies - 1 through 2 (of 2 total)