• Resolved alittle116

    (@alittle116)


    my wordpress blog is only a small portion of my website. i would like to have the 5 most recent headlines appear on my website homepage. as of now, my homepage is not connected to wordpress in any way.

    i am bran new to this. i appreciate the help!

Viewing 6 replies - 1 through 6 (of 6 total)
  • If you include the header file into your other page(s) via PHP then you can access any of the WordPress functions in the rest of the page.

    Thread Starter alittle116

    (@alittle116)

    instead of including the entire header file, can you tell me what code specifically needs to be on the page?

    I don’t mean include the actual file, I mean add a PHP include to the top of your existing (non-wordpress) PHP file. Thusly –

    <?php
    require(‘./path-to-your-blog/wp-blog-header.php’);
    ?>

    Then you can use the WordPress functions in the rest of your page.

    If you want to find *exactly* what PHP code to use instead of simply including the header, then a) I reckon you’re a bit mad and b) you’d have to check the header file code yourself to find out how it works.

    Thread Starter alittle116

    (@alittle116)

    i am sorry this is still not clear to me. on my non wp pages i am already including a header.php file.

    the wp header contains all sorts of stuff not relevant to the rest of my site and it does not seem right to include the whole thing.

    i would like to find out what code in the wp header file (i am using the kubrick theme) is necessary to allow wp functions on non wp pages. but i cant figure this out.

    i would like to find out what code in the wp header file (i am using the kubrick theme) is necessary to allow wp functions on non wp pages. but i cant figure this out.

    The theme you are using doesnt matter. So dont bring up it again.

    wp-blog-header loads EVERYTHING needed to include wp functions on non-wordpress files. And calling it doesnt add anything to a non-wordpress page that you havent asked it to– so if you are seeing something, you put it there.

    You can test that by uploading a blank php file, and using the include and NOTHING else.

    <?php
    require('./path-to-your-blog/wp-blog-header.php');
    ?>

    Furthermore, I am going to guess you are including the theme header — thats not what you want to include. LOOK at the code that was provided to you.

    Thread Starter alittle116

    (@alittle116)

    thank you. i understand now. since you are being so helpful, let me ask you one more question. how do i limit this list of posts to only 5 without making the changes in my admin panel?

    all my attempts at finding an answer have led me to the ‘Custom Query String’ Plugin.

    However this does not seem to be the right solution since my list of articles is not a query by date, author, category, etc…

    this is the code that i am using at the momemnt

    <?php while (have_posts()) : the_post(); ?>
    			<div class="post">
                    <div class="entry">
    					<p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></p>
    					<?php the_excerpt() ?>
                    </div>
                </div>
    			<?php endwhile; ?>
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Adding headlines to non wordpress page’ is closed to new replies.