-1

So my homepage is set to display the latest articles of my wordpress site. I use php to detect if the page has a special category in the header of my template and it works on every other pages at the exeption of my homepage that returns the category Blog(ID=12) wich is one of my category. When i go to my phpMyAdmin and look in the wp_term_relationships table I can see 3 posts using this category and they are actual articles. How can I unbind my index page of this blog category?

PS: I'm verry new to this wordpress thing, sorry if I'm unclear.

This is what's in the head:

<script>
    <?php
    $category = get_the_category();
    if($category[0]->{'name'} !== "Blog"){
        echo "document.onload = removeWhiteDiv();";
    }
    ?>
</script>
</head>
<body>
<div id="whiteDiv">
    <pre><?php print_r($category) ?></pre>
</div>
0

Well I havent found why there's a category to my homepage but I found the function is_home() and added it to my if:

if($category[0]->{'name'} !== "Blog" || is_home()){
      echo "document.onload = removeWhiteDiv();";
}
if($category[0]->{'name'} === "Blog" && !is_home()){
      echo "headerAnimation();";
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.