Forum Replies Created

Viewing 15 replies - 46 through 60 (of 60 total)
  • Thread Starter svedish

    (@svedish)

    Hi Esmi,

    Thanks for your answer. Wow, that sounds scary ?? To be honest I have never updated one version of WordPress. I hope this will work. Can it happen that my theme will break because maybe some tags or other structures have perhaps changed? I’m a bit cautious to be honest. I don’t want to mess up anything, mainly because it works as it is…

    Thanks a gain in advance for any advice.

    Thread Starter svedish

    (@svedish)

    Hi t31os_,

    I have to admit I don’t understand the answer ?? So sorry! But maybe my question was not very clear either, so my apologies if this is the case.

    Ok, let’s say I create a template called various_contents.php and I assign it for the page with the title “Various Contents” in the CMS. In the template file, after the page contents I paste ALSO the index.php Loop to get a list of posts as well. It just doesn’t work. That Loop works perfectly in index.php, but won’t work in my newly created page template. Why?

    Thanks

    Thread Starter svedish

    (@svedish)

    I think I’ll open a new thread with this last question, should I feed the urgent need to know why this works this way. ??
    I think we are quite off topic by now. As for “displaying posts on a page template”, which was the original title, I’d say the thread is Resolved. Thanks Michael! ??

    Thread Starter svedish

    (@svedish)

    Exactly!

    That’s why I was wondering why I can’t use the same loop in the page template to query posts? Maybe if you use it in a page template it queries the page contents (title, copy, custom fields etc.). If you use it in a “posts page-template” it automatically queries posts? Maybe WP has got automatic ways of knowing the scope of pages? I have no clue. It would be nice if anyone could enlighten me.

    Anyone out there that can help us with the answer to this question please?? ??

    Thanks a lot for all your help so far Michael!

    Thread Starter svedish

    (@svedish)

    Short, concise, to the point. Thanks a lot. Great and helpful reply. ??

    One comment only about your answer number 2:

    ? I understand you like WP-query (and I am also catching up about why WP_Query is better than other functions – reading around and starting to grasp the point). However when I said “why do I instead need to use those other functions” I meant, why do I “have” to. In other words, why doesn’t the index.php query output anything if I paste it into one of my page templates? Because of what you said under point 1. perhaps? Or for some other reason? Or perhaps it works and i did a mistake when I copied the code? ??

    Thanks.

    Thread Starter svedish

    (@svedish)

    Also, and sorry for being a complete newbie…

    Before I possibly feel comfortable with the other conversation, which is just one step ahead of my knowledge, can you please help me to clarify the basic principle here?

    If I go on the Loop Codex page I read that the loop starts with <?php if ( have_posts() etc. and ends with <?php endif; ?>.
    I can also read that “The Loop should be placed in index.php and in any other Templates used to display post information, but looks slightly different depending on your version of WordPress.” And I can see this in action if I open the index page.

    So far so good…So I thought: “Good, I just grab the Loop from the index page and throw it in my Staff page template, then I tweak it to display on posts in XX category and voila’! I get all the Staff posts”. Then I realized it didn’t work. The Loop was displaying nothing. I needed to use WP_query – or maybe query_post – and this is what you guys discuss in the other thread. Which one is best…

    But I still miss the previous bit. ?? Which, in short, is the following:

    1) Why does the Loop as it is (without any WP_query or query_post or get_posts), the one that starts with <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> and ends with <?php endif; ?>, work in the index.php page out of the box?
    2) therefore…why do I instead need to use those other functions (WP_query / query_post / get_posts) to query my posts from other places?
    3) Where do I need to use the other functions (WP_query / query_post / get_posts)? Just all pages that are not index.php?
    4) Finally, how many ways of querying posts are there? Just 2? The “regular one” and the “wp-query-posts-get-posts” one?

    As you can see, since the documentation is not extremely clear, I just need 2-3 basic principles clarified to then dive into if wp_query is preferable to get_posts.

    Hope it makes sense. ??

    Thanks again in advance.

    Thread Starter svedish

    (@svedish)

    Hi Michael,

    thanks for your help. Exactly the kind of stuff I’m looking for. Some more in depth conversation about how things really work under the bonnet. And at first sight, I agree with him, the Codex is rather confusing in that regard. I’ll have a proper read and may possibly participate to the discussion. ??

    Cheers.

    Thread Starter svedish

    (@svedish)

    hi Michael,

    thanks a lot for your answer and I think I fairly understand the things you told me about what WP does out of the box. In fact I get into trouble when I try to do something that possibly requires some extra “touches” ??

    In my scenario I’m studying how build a brochure website using WP, by building a website for a fictional company X. Therefore I will have, I don’t know, say 6 links to 6 pages and inside 1 of these pages (Staff) some content + a list of images / biogs for each employee of this fictional company. I thought it could be a good idea to use posts (with custom fields ofc) to create the employees’ records.

    Another consequence is that I’ll not have any blog-like menus showing up (Unless I decide to implement a news section in the website). That’s why I need to create a page showing posts from a category. Of course I could use children pages for the employees. I just happened to use posts for them.

    That’s why I would like to know a bit more about querying posts from any page. When to use the normal index.php Loop, why in the Page Codex section (A Page of Posts sample in https://codex.www.ads-software.com/Pages) wp_query is instead used etc. I have already taken that piece of code and tweaked it. My employees are showing up nicely. They have a portrait and the titles are not links anymore. Also, these info are coming both from 2 custom fields. Pretty advanced huh?? ??
    In short, I get things to work and all is fine. I just don’t understand why I’m using that code as opposed to, I dunno, say the regular “while-if-has-posts” standard Loop? I just found the example and bent it to my needs. Not very insightful…

    Hope what i say makes sense. Please let me know if it does not! ??

    Cheers

    Thread Starter svedish

    (@svedish)

    Sorry if I add here. What I’m trying to achieve here is understanding why I’m using the Loop that way there, as opposed to how I use it on the posts home page.

    I could copy and paste that code, label it with “use this and tweak it if you want to display posts on a page” and forget the whole thing, but I’ll never understand how this works

    Hope it makes sense. ??

    Such a good habit to post solutions we find alone. Thanks for sharing. ??

    Thread Starter svedish

    (@svedish)

    I’ve tried Flutter few days ago for an afternoon. The idea is brilliant in my opinion, but it is a bit buggy I have to admit. That’s why I was only looking for something very simple to allow custom contents fields.

    On the other hand, thanks a lot for the link. I didn’t spot that one so far. Looks really good. ??

    Thread Starter svedish

    (@svedish)

    Hi Michael,

    thanks for your answer. This, however, doesn’t really solve the problem of custom values. I have found the Custom Fields Template plug-in which may help in that regard. Have you ever used it? Would you recommend it?

    Thanks.

    Thread Starter svedish

    (@svedish)

    Hi Samboll,

    Thanks a lot for your answer(s). That’s surely something to start about. For example, I just learned how to get a third template from thew WP forum. :O It was not very intuitive. Too bad such a good piece of code doesn’t have a good newbie friendly complete documentation.

    Cheers!

    Same here,

    that box disappeared after installing Flutter. I know the template can be chosen from the Flutter settings (where you edit your Write Panel ). I am choosing the custom template from the list there, but he keep using the page.php template. So, it still doesn’t work. Any help out there please?

    Also, if this plug-in is really buggy, can anyone please point me in the right direction for a simple CMS plug-in that works? I don’t need in place editing. I just need something that does what it says on the tin. Cheers!

    Thanks a lot.

    Hi there.

    Pretty new to the forum. I am having the same problem and I see your post is 3 months old. Can you please tell me more about what you did? I’m sorry, but I can’t understand what I’m supposed to do? Did you also perhaps find a way to do this without hacks?

    Thanks in advance for your time. ??

Viewing 15 replies - 46 through 60 (of 60 total)