• First attempt at theme development. In trying to format the post, reply form, comments and reply form to display on my Blog Page I am getting an ‘incorrect’ duplicate form (where the correct form should be placed) and the “correct” form is displaying below the footer of the page, where I do not want it.

    I have made notes on the template parts, that show up on the displayed page, to help identify what, is coming from where. They are labeled as “CLS DEBUG NOTE” to help to make the issue easier to see.

    LINKS TO PAGES :

    Here is the main Blog Page which is displaying correctly, as reference:

    Main Blog Page

    This is one post page with a comment that is not displaying correctly, follow notes on the page

    incorrect form placement

    Final link shows comment made on one post showing up on an entirely different post page than the comment was made on. Comment made on “hello World” post but showed up on ” hope this works” post page.

    Posted on Wrong Page

    I think this might be simple, but at this point I don’t yet know enough to recognize what I’m seeing to fix it. As well, any recommendations to the “Definitive Theme Template” or tutorial will be much appreciated.

    Thanks Again!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter clsimco

    (@clsimco)

    This post is about debugging

    Moderator bcworkz

    (@bcworkz)

    Use a very basic starter theme, like the one from underscores.me for guidance on proper template structure. It’s not the only way, but it does work. Personally, I’d build my theme on top of the starter theme. Saves me a lot of effort developing generic boiler plate code. But even if you’re starting from nothing, it can be a good example to follow.

    Something’s wrong with that form you don’t want anyway. As it’s going away, it’s not worth finding the problem. The form below the footer at least displays to me like it should for a non-logged in user. Comment form is usually generated by calling comment_form(). If such a call is not evident, you may need to look at a template part, like comments.php or similar.

    Content normally appears on the page in the order it was output. While it’s possible for CSS to reorder elements, it’s better if they naturally occur in the order you want to start with. You typically don’t want comment content in the actual footer, but as part of the post template like single.php or similar. Conversely, identifying code on a template responsible for certain output can be assisted by identifying more recognizable code generating output before or after the questionable content.

    As to comments assigned to the wrong post, if you are using the first form which has a problem, stop doing that ๐Ÿ™‚ It needs to go away. The version below the footer ought to be relocated, it looks more promising. If you continue to have trouble even with the more promising form, it is often due to the global $post object having the wrong post due to a secondary query on the template where its query data was not reset with wp_reset_postdata().

    Thread Starter clsimco

    (@clsimco)

    Thank you sir, for your detailed insight. You are absolutely correct in your key observations. At the basic level I understand what you are saying, and that is why I made the notes on the template parts to identify what is being called and displayed, and where displayed. That, with the objective to “fix” it.

    Taking the points in your reply in order:

    Use a very basic starter theme, like the one from underscores.me for guidance

    Yes, (I have that one and others to play with) The bulk of the styling and most theme components are from a tutorial that I followed.

    Somethingโ€™s wrong with that form you donโ€™t want anyway. As itโ€™s going away, itโ€™s not worth finding the problem. The form below the footer at least displays to me like it should for a non-logged in user.

    Yes, you understand perfectly. I can delete the code that is in the “div” in the display page, that is being called from “content-single.php”. The form and comments that are being displayed below the footer IS INDEED what I want to replace it. I’m trying to learn / understand how to call it there (and why it’s placing itself there in the first place so that I can fix it.

    Conversely, identifying code on a template responsible for certain output can be assisted by identifying more recognizable code generating output before or after the questionable content.

    Yes, I understand and agree. Again why I placed the DEBUG notes. I’m just stuck for what to do about it.

    As to comments assigned to the wrong post, if you are using the first form which has a problem, stop doing that ๐Ÿ™‚ It needs to go away. The version below the footer ought to be relocated, it looks more promising.

    Yes! You understand! Again that’s why I placed the DEBUG notes. the form above the footer IS wrong (it’s from the tutorial I followed, as mentioned earlier) and I will make it go away. I’m just stuck on how to call the code that displays the footer that I WANT to be there, the one that is displaying below the footer, whose source file is “comments.php”

    So to be clear, I see exactly what you are saying and suggesting, but I have exhausted the extent of my knowledge for how to fix it. I could and willing to post the code for each of the three .php pages involved, if that would help.

    Moderator bcworkz

    (@bcworkz)

    Following the underscres.me model, any comments and the comment form appear by calling comments_template(). This loads in the comments.php template, which outputs any comments with wp_list_comments() and outputs the comment form with comment_form(). It looks like you’ve called comments_template() from the footer.php template, or it’s on your main template file (apparently content-single.php) after the call to get_footer(). It’s in the wrong place, where ever it is. Find it and remove it.

    It seems you have a call to comment_form() in the right place (the first comment form), where the comments list is missing. Replace this with comments_template(), assuming your theme has a comments.php template just like the underscores.me theme does.

    If you still do not find this helpful, my apologies. I’m trying ๐Ÿ™‚ In that case maybe it would be helpful to see the code you have. Don’t post it here though. Please post your template code at pastebin.com or a gist.github.com and just provide the links here.

    Thread Starter clsimco

    (@clsimco)

    Thank you! That REALLY helps point me in the right direction. I’ll dive into your suggestions and investigate later today, then let you know. MUCH appreciated.

    Thread Starter clsimco

    (@clsimco)

    Hello bcworkz

    I wanted to thank you for your help in pointing me in the right direction to solve the issue that I was experiencing. You made a BIG difference with your clear explanations, allowing me to move in the right direction to solve the issue while actually learning.

    I followed your suggestion and implemented the _s frame, then carefully studied the template structure / parts / code, in order to layer my design on top and manipulate a couple of elements in _s. In doing so, using elements of Google Material Design, MDBootstrap and Material Kit, first and foremost, the div structure needed to achieve the correct display fell into place, so that the comments section displayed in the correct place. (NOTE: I am not taking credit here for the design elements, merely implementing and learning to manipulate them.)

    That said, I have other questions that have arisen, but I am not certain of best practice, etiquette here in this forum. Specifically, should I start a new topic for each question even if related to the original question?

    Thanks again

    Moderator bcworkz

    (@bcworkz)

    New topic or not for a related question is a judgement call. Other people tend to not read topics with several replies. A question in this topic is likely to only be answered by me. I’ll happily answer if I can, but I’m not the fount of all knowledge ๐Ÿ˜‰ A new topic will get a lot more “eyes” on it. But if it’s a coding question, there’s half a chance I’ll end up answering anyway. There aren’t all that many coders here who frequently answer questions.

    I guess I’m saying you can ask here, but you’re better off starting a new topic. Just don’t start topics asking the same question in multiple sub-forums. Also don’t address topics to certain members. These are open forums, not personal message boards. You seem to realize that different forums have different etiquette to follow. We’re no different. While we do have guidelines, there remain some unwritten preferences for behavior. We’re generally forgiving of most transgressions, so don’t worry too much about doing something wrong. One exception, abusive behavior towards others is not tolerated, but you’re clearly not one of those people ๐Ÿ™‚

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Comment form misplaced’ is closed to new replies.