WordPress.org

Ready to get started?Download WordPress

Forums

Unable to solve code problem. Looking for clear guidance. (18 posts)

  1. matmochdre
    Member
    Posted 5 years ago #

    Hallo. I have posted this problem before and 2 days later find myself still struggling with the same thing even after advice. I simply cannot do this alone as I do not have the know how. If some one could please look at this code and the problem in general, then provide a fix I would be a very happy man.

    I have been customising a theme and have created a page that will only show posts from a specific category. The problem that I am having is that this page also has a sidebar. All was well until I put a second post on the page which made the sidebar move.

    I've been trying to find a fix but as yet have had no joy. I'm sure it's a problem with the code for the page I just don't know what or where.

    The code looks like this:

    <?php get_header(); ?>

    <div class="archive_single">

    <div class="left"><< <?php previous_post_link('%link') ?></div>
    <div class="right"><?php next_post_link('%link') ?> >></div>
    <div class="clear"></div>

    </div>

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    <div class="single">

    <div class="single_post">
    <h3><?php the_title(); ?></h3>

    <?php the_content('<p class="serif">Read the rest of this entry ยป</p>'); ?>

    <?php the_tags( '<p>Tags: ', ', ', '</p>'); ?>

    </div>

    </div>

    <?php endwhile; else: ?>

    <p>Sorry, no posts matched your criteria.</p>

    <?php endif; ?>

    </div>

    <?php get_sidebar(); ?>

    And here is a link to the page so you can see the sidebar problem:

    http://mr-o.com/news/?cat=11

    I would really appreciate help with this as I'm out of my depth. I've have tried to fix this myself but have failed.

    Thank you, Mat

  2. Technokinetics
    Member
    Posted 5 years ago #

    Mat,

    A few things that need fixing:

    First, your navigation menu appears in the <head> of your page, when it should be in the <body>.

    Second, your menu code is malformed, with an extra list item wrapping the whole list.

    Third, you've self-closed your p#top tags: <p id="top" />. These should just be <p id="top">

    Fourth, you've forgotten to close your content div.

    If you fix these, and the problem persists then I'll take another look.

    Cheers,

    - Tim

  3. t31os
    Member
    Posted 5 years ago #

    I had suggested you run the code through the validator in your last thread here...

    http://wordpress.org/support/topic/243077?replies=7

  4. Technokinetics
    Member
    Posted 5 years ago #

    Mat,

    The suggestion from tE1os that you use a validator to debug your code is a good one; this can really help in pinpointing problems.

    Don't worry, you'll get there. I know that this can be frustrating, but soon you'll have a great-looking site that's a breeze to maintain. Just a little more to do first...

    - Tim

  5. matmochdre
    Member
    Posted 5 years ago #

    Hallo

    Thanks for the replies. t31os I did take a look at the validator but the problem I have with it is I firstly can't understand half is what is written and then it seems to give a lot of possible causes but no defined solution. Or at least it looks that way to me.

    Tim the menu is placed in the header in the theme that I am using/customising. This seems to work fine for the other pages and the sidebar remains in place. The sidebar only moves on the one page that I have created, to show posts in the the category "Inspiration".

    I'll try the other changes that you mentioned and see what happens. It would be great if you could keep am eye on this thread as I would really appreciate some help from a more experienced coder.

    Thanks once again, Mat

  6. Technokinetics
    Member
    Posted 5 years ago #

    Tim the menu is placed in the header in the theme that I am using/customising.

    It's not just in the header at the moment; it's in the head.

    - Tim

  7. matmochdre
    Member
    Posted 5 years ago #

    I just thought of something that may be causing the problem. When I created the page to show only posts for the category "Inspiration" I used the single.php page and re-named it category-11.php (Inspiration is category 11.)

    If the single.php file is only designed to show one post then maybe it explains why the sidebar was in the correct place when only one post was shown on the "Inspiration" page. As soon as I added a second post to this page the sidebar moved. Would this be because I am trying to show more than one post in a page that is designed to show only one?

    I hope that all makes sense. I've almost confused myself :)

  8. matmochdre
    Member
    Posted 5 years ago #

    Tim, thanks again for such a quick reply. Weekend duties are calling so I have to leave my computer. I'll have to get back to this this evening. Would be great to pick it up then.

    All the best, Mat

  9. iridiax
    Member
    Posted 5 years ago #

    The head is NOT the same as the header. Please follow the advice I and others gave you about fixing your code.

    http://wordpress.org/support/topic/243077
    http://wordpress.org/support/topic/242813

  10. matmochdre
    Member
    Posted 5 years ago #

    I understand that the head is not the header. However in the theme that I chose to try and customise the code relating to the menu as well as the search bar has been put between the <head> tags.

  11. matmochdre
    Member
    Posted 5 years ago #

    So I have looked at what you suggested Tim and again I"m at a loss.

    I have found the mistakes that you highlighted however the code on the published page looks very different to what I am seing when I open the page in Dreamweaver.

    For example the menu list in the publised page looks like this:

    <div id="meniu">

    </div>

    When I open header.php it looks like this:

    <div id="meniu">

    • <?php wp_list_categories('hide_empty=0&title_li=' . __('') . '' ); ?><?php wp_list_pages('title_li=' ); ?>

    </div>

    I can't seem to see the extra list item in the code above. If it's there I apologise, but like I've said my knowledge of coding is very basic.

    It's the same with the p#top tags: On the site it looks like:

    <p id="top" />This is another test.</p>

    In single.php I think I found what generates that bit of code and it looks like this:

    <?php the_content('<p class="serif">Read the rest of this entry »</p>'); ?>

    So if anything this confirms what I said above. I'm totally out of my depth. The only solution that I can come up with that I feel capable of doing is to remove the sidebar from this page.

    The other alternative that I have is to pay a coder to sort the page out. Is there a pool of coders somehow connected to this forum. Tim would you be interested in doing this?

    Thanks once more for your patience and help.

    Singed: A very frustrated newbie who is unfolding his white flag in preparation to hoist it high.

  12. Technokinetics
    Member
    Posted 5 years ago #

    That's an error; move it.

  13. matmochdre
    Member
    Posted 5 years ago #

    Sorry? I'm confused by the last post. What was it addressed to?

  14. matmochdre
    Member
    Posted 5 years ago #

    Sorry. Got it now. I did move the menu into the body. Still lost on the other points though.

  15. matmochdre
    Member
    Posted 5 years ago #

    Hallo,

    Still trying to work out how to fix the code. Tim is it possible that you could explain the problems I brought up in the post that is 4 places above this one? The one with the all code in it.

    Also I'm still interested to find out if there are coders connected to this forum that can be paid to fix the problem.

    Thanks, Mat

  16. Technokinetics
    Member
    Posted 5 years ago #

    Mat,

    I think we were posting at the same time. My "That's an error; move it" message was directed at your "I understand..." post.

    This isn't the place to do business (the WP-Pro list is for that), but please feel free to email me (tim@technokinetics.com) for more help.

    Tim

  17. matmochdre
    Member
    Posted 5 years ago #

    Yes I thought that was what happend. I'll be in touch via e-mail. Thanks again. Mat

  18. SeanBorg
    Member
    Posted 5 years ago #

    Could somebody give me some advice on my Front page please.

    I think it's a code error:

    I am having problem with front page of my blog and was wondering how to fix it. I bought word press for Dummies - and I must be a big Dummy as I can't seem to find the page relating to my problem. If you look at my site then you will hopefully see what I mean. There is a large GAP at the top of the page and I can't seem to find a solution to fix this - would anybody know where I should look to start to fix this?

    http://www.seanborggoesla.com/

    I am in LA and if there were any classes I could attend for Word Press I would love to hear of them too.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.