9 replies
Is there anyway to edit the HTML of a single post on Wordpress?

Let's say that I have an image in my single.php that shows up on all of the posts on my site. However, I don't want that image on one of those posts. How can I remove that image from the single post that I don't want it on?
#wordpress
  • Profile picture of the author Mohsin Rasool
    Hi Mike,

    When you say page.php are your referring to theme file for pages?

    If that is the case.. then simple copy that page.php to some page1.php theme
    file in your theme folder. And simply remove that image line from it.
    It is called Page Templates...

    Pages « WordPress Codex

    Pages « WordPress Codex

    Then for the post you want, not to show that image.. simply choose this page template.
    By going to that page and then click EDIT.. and then in right sidebar.. you have a box
    where you can select THIS NEW PAGE TEMPLATE...

    Let me know if this help or if something does not make sense..i will try to write
    more clearly..

    Regards,
    Mohsin
    {{ DiscussionBoard.errors[3352293].message }}
  • Profile picture of the author Mike Hlatky
    Thanks!

    But, I must be blind. Where is the option to change the theme?
    {{ DiscussionBoard.errors[3352376].message }}
  • Profile picture of the author Mike Hlatky
    Sorry I made you explain it again, I understood the first time :p

    However, I wanted to know if this was possible to do for a single post, NOT a page.

    Sorry for the confusion.
    {{ DiscussionBoard.errors[3353433].message }}
    • Profile picture of the author suemax
      Originally Posted by Mike Hlatky View Post

      Sorry I made you explain it again, I understood the first time :p

      However, I wanted to know if this was possible to do for a single post, NOT a page.

      Sorry for the confusion.
      Well, Mike, you DID ask about pages!!! We will try to answer what you asked....
      Signature

      Master Resale Rights are so versatile, and these are educational, too. All kinds of IM material. Read, sell, break up into articles, combine into bundles, and there are 250 of them, complete with MRR, here for a bargain price! I'm even throwing in the sales page. Only £37 for Warriors. http://www.250mrrproducts.com

      {{ DiscussionBoard.errors[3353444].message }}
    • Profile picture of the author Mohsin Rasool
      Originally Posted by Mike Hlatky View Post

      Sorry I made you explain it again, I understood the first time :p

      However, I wanted to know if this was possible to do for a single post, NOT a page.

      Sorry for the confusion.
      Oh I am sorry i should have not assumed it as PAGES
      Ok i have not used this but i see this plugin adds this missing capability in Wordpress
      WordPress › Custom Post Template « WordPress Plugins

      After this plugin install, posts are supposed to show same custom template panel for Pages!

      Hope this help,
      Mohsin
      PS. Mike please do not forget to update here if this plugin helped in this situation,
      so we know that if this plugin works as it says... it will be good addition to use in next
      project if any client wanted this functionality... !
      {{ DiscussionBoard.errors[3356035].message }}
  • Profile picture of the author Istvan Horvath
    Well, maybe the OP has ben edited/changed later... because now it asks about post and (correctly) single.php!

    You can edit the single.php template file - and my advice always is: NEVER EVER use the idiotic online theme editor:
    1. it leaves your blog vulnerable
    2. it doesn't have an UNDO button!!!

    So, now to the editing: you need to use one of the Conditional Tags of WP.
    Specifically, this: Conditional Tags « WordPress Codex

    you will need to use the if_single('XXX') - where XXX is your post's ID.
    Signature

    {{ DiscussionBoard.errors[3357069].message }}
  • Profile picture of the author Evan-M
    give this try

    give you the option for post templates the same as the default WordPress gives for pages
    WordPress › Custom Post Template « WordPress Plugins

    (adds the "post template" drop-down box to your post after you create a post template page )

    use

    <?php
    /*
    Template Name Posts: New Template Name
    */
    ?>


    instead of

    <?php
    /*
    Template Name: New Template Name
    */
    ?
    Signature

    Evan-M

    Easily The Worlds Best Wordpress Popup plugin

    Visit Website Design Firm For All Your Wordpress Coding Needs

    {{ DiscussionBoard.errors[3358510].message }}

Trending Topics