Support » Plugins » Hacks » Replace post/page content dinamically

  • Hi all.
    I’m wondering if this is possible.
    All this regards a possible emergency situation:
    if there’s no emergency, then you have to behave like this
    if there’s this emergency, then you have to do this, this and this.
    The emergency situation is published on the front page of the website.

    I’ve planned a situation like the following:
    In the front page I have one sticky post, let’s call it Apost, that belongs to category A. If this is published, then I have a particular page (Apage) published too.
    If I publish Bpost, and this is sticky, I want to have Bpage published, no more Apage.

    How can I develop that?

    Thank you

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator bcworkz


    Sticky post IDs are stored in options table as an array under the key “sticky_posts”. Just use get_option() and update_option() to swap post IDs.

    Ooohh, thank you bcworkz!!! I’ll give it a try!

    I’m thinking about developing a child theme that’s triggered in that situation.

    Moderator bcworkz


    Good idea. Child themes are a good place to keep your hacks and modifications so they do not get overwritten during an update.

    I imagine many people could use this sort of feature. If you’re hoping others can benefit from your efforts, most people will find a plugin more useful, if you can stay away from theme specific coding.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Replace post/page content dinamically’ is closed to new replies.