• D C

    (@danecarbaugh)


    I’ve searched and searched and cannot find an answer about how to do this. Here it goes.

    The result I want: I’d like to be able to publish an article to a content category called ‘Breaking’. Keep in mind that the content category has no other articles in it. When I publish this article, I’d like a new div to appear on the page I designate – in this case, the home page – and show the thumbnail, article h3 as a link and excerpt text.

    How I’ve tried to do it: I figure the code in my header looks something like this, but I have no idea.

    <?php if (is_page('home') ) && is_category_ID('157');
                     echo <div id="breaking">;
                     echo // Whatever the content is?;
                     echo </div>;
    } ?>

    I’m sure that’s all wrong and such. I know the first line is probably garbage because that code is checking if the category is on the home page.

    What I want it to do is check and see if it’s the home page, and if so, run an action that checks if there is any content in the ‘Breaking’ category. If there is, I want it to get the thumbnail, excerpt and title from that article and put it in a div called “breaking”. Does that make sense? It’s for when there’s breaking news on the site.

    No, the site isn’t live or anything so I can’t send you to it, sorry 🙁

    If there’s a forum entry up on this already I’d gladly be sent to it. Thanks for your help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter D C

    (@danecarbaugh)

    I forgot to add that when the breaking news that is happening is over, I’d like to delete the article and the div will deactivate because there won’t be any content in the Breaking category. So at max, there would be one article in the category at any given time (usually none).

    Thread Starter D C

    (@danecarbaugh)

    bump?

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

The topic ‘PHP Script that Activates a Div & prints some content?’ is closed to new replies.