How can I make a dynamic web page in PHP?

How do I code for WordPress to make the index.php (landing page of a blog) so it is not connected to a single.php (article page)?

  • I have a fundamental knowledge of WordPress, and web development in general. So here is one for you to puzzle over. How do I code for WordPress to make the index.php (landing page of Blog) so it is not connected to a single.php (article page)? Where do I want the links to go if not to generate article pages? Well, try to think of this blog as a twitter feed with the tweets as links to PDF’s, Video’s, etc. So just a bunch of re-directional content, that I don’t want the user to have 3 extra clicks to access. So my Questions are how do I remove the connection that single.php and index.php have? Would it be better to just to forget about the index and start new with a custom?   Thanks for any and all help

  • Answer:

    I don't think you need to worry about the different page templates when it comes to making a page act how you want. It sounds like you want a landing page of sorts, without worrying about other pages on the site being connected via any menus or links, and that's easy to do without having to worry about other templates. You don't need to hide something if you aren't using it, after all :) I'm assuming that you're adding this onto an existing site, since while you can make a one page site very easily with WordPress, you also don't need to worry about that overhead if you don't need it. In this case, I would look into making a new page template, with all of the PDFs and videos linked to it directly. I can't walk you through the specific coding without knowing your needs, but this page from the WordPress Codex (an excellent guide for most any development question that you may have with WordPress) would be a good place to start with some sample code. http://codex.wordpress.org/Page_Templates

David Laietta at Quora Visit the source

Was this solution helpful to you?

Other answers

Use a custom template, like front-page.php ;-)

Nick Ciske

Just from a strictly WordPress developer's perspective, I'm still learning how PHP, CSS, Java, JavaScript, Python all play with each other, so I'm not going to hazard guess on that level. What I will say from a business management perspective and WordPress developer's perspective is it's much simpler to a) create a one page theme, b) create a landing page (Ultimate Coming Soon Plugin is great), c) create a single-page with no external links to other pages and no menu. Personally, since you know I'm not a PHP programmer per se (at least not yet, although I know my way around it sufficiently to make some minor alterations to themes), I would follow Occam's Razor and take the path of least resistance, saving time, and ultimately money. I would create a new custom theme (and have done this hundreds of times) and as I said, just don't create a menu or hide certain pages or just don't link to them or have the theme be just one page.

David Somerfleck

What I have understood is that you want to have the blog home to index bunch of links(to pdfs,videos etc) which you want to supply in form of individual posts. So rather than trying to modify standard wordpress template engine hierarchy I would take this route>> I will define a custom field for posts and while creating a new post I will supply the link/url in question in this field.You can use plugins like advanced custom fields as well. Add support for post format link. Create a page template for link post format without title etc and keep only the link. In homepage now wordpress will display your links only. I can add some code snippet if I know this is what you are after.

Pritam Sarker

Holly,  I just saw the notification and I apologize for the delay in answering your question.  When you take a look at the wordpress template hierarchy (http://codex.wordpress.org/Template_Hierarchy), you find that wordpress looks to front-page.php first as the opening page, if that is not present, it looks for home.php and if that is not present, it finds index.php.   So any of those will do just make sure a higher hierarchal file is not present and trump your attempts of establishing a front page.     Any out of the box or boiler plate theme will give you a home and/or index.php that gives you a basic front page that spits out your posts.   We call it the loop and its a beautiful thing as long as that is what you want.  However, if you want something completely different then kick that loop to the curb. Here is the loop for your reference: [code] <?php if ( have_posts() ) : ?>    <?php /* Start the Loop */ ?>     <?php while ( have_posts() ) : the_post(); ?>            <?php                                         /* Include the Post-Format-specific template for the content.                      * If you want to override this in a child theme, then include a file                      * called content-___.php (where ___ is the Post Format name) and that will be used instead.                      */                  get_template_part( 'content', get_post_format() );                 ?>         <?php endwhile; ?>      <?php paging_nav(); ?>    <?php else : ?>       <?php get_template_part( 'content', 'none' ); ?>         <?php endif; ?> [/code] *Source: I pulled this from the _s boilerplate theme.  Other themes will look slightly different but the structure is pretty close across most themes. So here is where I would start:  1)  Grab a boiler plate theme (or use your existing theme) and activate it. 2)  Make a copy of home.php or index.php and call it front-page.php 3)  Delete all the components of the wordpress loop starting with the if(have_posts()): line. 4)  For pure amusement, put a nice <h1> HELLO WORLD </h1> where the loop used to be 5)  Try reloading your site and see what happens. There is alot more to go with this, but I think following those five steps will give you a good idea of killing any blog post content on your front page.  Your next question should be if you want your headers and footer to stay the same including your nav bars.  Feel free to ping me if you have any further question.

Mauri Rummel

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.