WordPress.org

Ready to get started?Download WordPress

Forums

Removing post title so I can use WP as a STATIC CMS (11 posts)

  1. Pressnoob
    Member
    Posted 1 year ago #

    Hello, so basically I want to manage a simple static website. My template is pretty much <?php get_header ?> and <?php get_footer ?> with the loop in between those. My goal is to be able to create pages and posting the HTML code, effectively between the header and footer directly. But whenever I post I get this of course:

    "Test
    October 1st, 2012 by admin
    testest
    Posted in"

    I don't know enough PHP to modify the loop code itself which I tried doing. I also tried making a functions.php that had this:

    <?php
    add_action('genesis_before', 'child_conditional_actions');
    function child_conditional_actions() {
    if ( is_page() )
    remove_action('genesis_post_title', 'genesis_do_post_title');
    }
    ?>

    But it did nothing. Does anyone have any advice?

    This is the full loop code I used in case anyone's curious:
    http://pastie.org/4894413

  2. Max
    Member
    Posted 1 year ago #

    You need to contact Studiopress for this, you are using a commercial framework, and they will support it.

  3. Pressnoob
    Member
    Posted 1 year ago #

    What do you mean by commercial framework? I just converted my html/css into a wordpress theme.

    It's all just php anyways, there must be a way to work around this easily? I'm in the process of learning programming but PHP is so far away -_-;;

  4. Max
    Member
    Posted 1 year ago #

    This code:

    <?php
    add_action('genesis_before', 'child_conditional_actions');
    function child_conditional_actions() {
    if ( is_page() )
    remove_action('genesis_post_title', 'genesis_do_post_title');
    }
    ?>

    Is from the Genesis framework, which is a commercial framework created by studiopress. I take it from your response that you may just have found this online and cut-and-pasted it into your theme... :-)

    If you are just wanting to display the HTML that you have added to the content window of a new page in the backend of wordpress you should just be outputting this in your loop:

    <div class="entry">
       <?php the_content(); ?>
     </div>

    Also, the code that you have there is testing to see if something is in a category numbered 3?

    <?php if ( in_category('3') ) { ?>
               <div class="post-cat-three">
     <?php } else { ?>
               <div class="post">
     <?php } ?>

    I have a site that is used as a CMS, so maybe the contents of my page.php would be useful for you:

    http://pastebin.com/ca4yyMbT

  5. Pressnoob
    Member
    Posted 1 year ago #

    Whoooops. My bad! Thank you for pointing that out ^_^; I will try your suggestion while I munch on some chicken.

  6. Pressnoob
    Member
    Posted 1 year ago #

    Hey Max, I don't quite understand your code. I don't know php at all, or any of the functions or objects that WordPress uses.

    This is what I tried:

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
     <div id="container">
       <?php the_content(); ?>
     </div>
    
      <?php endwhile; else: ?>
    
     <p>Sorry, no posts matched your criteria.</p>
    
     <!-- REALLY stop The Loop. -->
     <?php endif; ?>

    I was able to paste directly but it ruins my entire style for some reason. I replaced the div class with a styled div called "container". I don't really understand how WP returns the content to the div "container" but I believe that's what it does? Returns the strings and puts it into 'the_content' variable?

    If that's the case my HTML should be working perfectly but it's not. The layout breaks. I'm doing something wrong.

  7. Pressnoob
    Member
    Posted 1 year ago #

    I also tried leaving the class as is and wrapping it around a DIV like you did in your code, but the layout still breaks.... But it's much better than before. Also might be important to note that the images are missing for some reason.... But when I leave the HTML code inbetween header php and footer php in the original document the images show up fine.

    <div id ="container">
     <!-- Start the Loop. -->
     <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
      <div class="entry">
       <?php the_content(); ?>
     </div>
    
     <?php endwhile; else: ?>
    
     <p>Sorry, no posts matched your criteria.</p>
    
     <!-- REALLY stop The Loop. -->
     <?php endif; ?>
    </div>
  8. Pressnoob
    Member
    Posted 1 year ago #

    Okay this is embarrassing.After a while I figured out the comments in the HTML were causing the layout breaks. It gets parsed in the wordpress editor.

  9. Max
    Member
    Posted 1 year ago #

    You should be editing these files with an editor from either the command line of your host, or better using something like Coda on your local machine and then sending the modified file back to the host using ftp, and that is only for a site that is not really in production.

    The built in WordPress file editor is only good for really small changes, and you run the risk that leaving out a semi-colon or something equally mundane will break your install and give you a white screen.

  10. Pressnoob
    Member
    Posted 1 year ago #

    Thanks Max, I got WP literally yesterday. I'm using a self-contained one called Instant WordPress cause I had to do this on short time.

    The editor definitely has its limits. It's not dispplaying any of the images when I try to edit the HTML in page editor. It's definitely a pathing issue since I'm using <?php bloginfo('template_directory'); function.

    When I put in <?php echo get_bloginfo (template_directory'); into the PHP template itself, it shows the path and what I should be currently using should work. When I put that into the html editor nothing happens... So php tags don't seem to work in it.

    I'll look into Coda. Thanks.

  11. Pressnoob
    Member
    Posted 1 year ago #

    I have a follow up question though... So let's say my page design is done and I want to create a new wordpress page and insert the HTML without having to put it throught he wordpress html editor, what exactly do I do next? I add a page set it up, but then insert the HTML through command line or CODA?

    Images are still not working because I'm using the php function in the html.

Topic Closed

This topic has been closed to new replies.

About this Topic