Support » Plugins and Hacks » Hacks » Create Duplicate Posts and Use Random Function

  • Resolved Rahul Chowdhury

    (@rahulchow)


    Hi,

    I want to create a duplicate copy of the existing posts on my blog while applying a different styling to the duplicate post pages and use a random function to call those duplicate pages and not the actual post pages.

    So that when anyone clicks the random button, they are taken to the duplicate post pages with different styling from that of the original post pages.

    Can anyone help me with this?

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

    (@bcworkz)

    I don’t see the need for duplicate posts. Simply apply different styles to the same post content. That’s pretty much the concept of using css. I believe there’s a way to use javascript or jquery to apply different stylesheets to the html page. If not, it could be done in the header template.

    I think you are not getting my point, actually I want to create a type of slideshow on my blog with my existing posts, so I want to keep my existing posts as well as create a duplicate copy of it, and give it a different styling.

    I then want to call those duplicate pages repeatedly using a random function to call those pages.

    So, in short I want to keep my existing posts with the current styles as well as create a duplicate copy of them with different styles, and then use a random function to call them.

    Moderator bcworkz

    (@bcworkz)

    Yes I got your point. You didn’t get my point that the styles should be separate from content, so the post/content can be endlessly restyled without changing the post/content. As is done at http://www.csszengarden.com/ (click one of the ‘design’ links on the right to see my point in action)

    But perhaps you have inline styles in your post. (poor practice) Or you need to populate you slider. (which you shouldn’t need) No matter 🙂 You can duplicate posts by getting a post with get_post(), unsetting the ID in the returned post object, then passing the object to wp_update_post() or wp_insert_post(). The object ends up in the same place either way. Your new duplicate post ID is returned.

    Cheers!

    Thanks for the support. 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Create Duplicate Posts and Use Random Function’ is closed to new replies.