WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Create Duplicate Posts and Use Random Function (5 posts)

  1. Rahul Chowdhury
    Member
    Posted 1 year ago #

    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?

  2. bcworkz
    Member
    Posted 1 year ago #

    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.

  3. Rahul Chowdhury
    Member
    Posted 1 year ago #

    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.

  4. bcworkz
    Member
    Posted 1 year ago #

    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!

  5. Rahul Chowdhury
    Member
    Posted 1 year ago #

    Thanks for the support. :-)

Topic Closed

This topic has been closed to new replies.

About this Topic