Add WordPress powered News Feed to bespoke website, only to one page on whole site

I have never used WordPress before, so please forgive my naivety…

I have built a bespoke website that is not currently managed by WordPress. For SEO purposes and to announce special offers etc, my client would like to add a News Feed to the site. To save me having to write a bespoke CMS for a single page, I would like to implement WordPress on just this particular page.

Read More

I am currently very confused as to how WordPress works as, believe it or not, there is too much information on the net and resultantly I am just left baffled…

I was therefore hoping that someone may be able to answer a few of my queries, thus pointing me in the right direction for creating this WordPress powered News Feed.

Here are my questions:

  1. In Plesk, it offers me to install WordPress on a site, how does this differ to just copying the WordPress directory to my site and going through the steps on the pages?
  2. Is there a particular part of WordPress that I should be looking at in order to implement a custom News Feed?
  3. I have noticed that there are PHP wp_* functions, is there documentation for these?
  4. Does it matter which directory WordPress is installed in? i.e. if my website is at httpdocs/, should I be placing WordPress into httpdocs/wp/?
  5. Where does my client go to to login to WordPress? I assume it will be http://domain.com/wp/, is this correct?
  6. Does WordPress manage all of the data as in images, text etc? Obviously it stores the text in the DB, but what directory does it store all the images in?
  7. I will inevitably be implementing an infinite scroll on the News feed page, therefore, how would I go about retrieving the data from the database, with limits for paging etc?

Please note, I am not asking you to write the code for me, I simply need pointing in the right direction.

Update

I have now installed and configured WordPress… However, I am still having issues with particular things in WordPress.

At the moment WordPress is installed in a sub directory, I have configured this within General Settings so WordPress is aware. I have done this because I do not want all the WordPress files in my root directory for the sake of a simple News Feed!

That said, I now have the following issues:

  1. Whilst I am not really bothered by this, WordPress is not seeing my site in the ‘Preview’. So when I preview a post, it uses one of its themes instead of my site. Can this be changed?
  2. There are a lot of options for me to fiddle with within WordPress, as this is just for a simple News Feed, is there anything I can do to simplify my WordPress screen and options?
  3. If I want to add a post to my News Feed, what should I do? Add Page? Add Post? etc…

Once I have worked out, with the help of Stackoverflow, the above, I will then be able to proceed to using the WordPress functions to gather my feeds from the database. In the meantime, I simply want to get the above sorted…

Related posts

Leave a Reply

1 comment

  1. To utilize WordPress‘s functionality you can use WordPress as a function library, for example, you can include WordPress in any page on your site using

    <?php 
        define('WP_USE_THEMES', false);
        require('./wp-blog-header.php');
    ?>
    

    This is wp-blog-header.php

    if ( !isset($wp_did_header) ) {
        $wp_did_header = true;
        require_once( dirname(__FILE__) . '/wp-load.php' );
        wp();
        require_once( ABSPATH . WPINC . '/template-loader.php' );
    }
    

    This will, do the rest for you but keep the complete WordPress in your site’s root.
    This is an example that is outside of WordPress

    $posts = get_posts('numberposts=10&order=ASC&orderby=post_title');
    foreach ($posts as $post) : start_wp();
        the_date(); echo "<br />";
        the_title(); 
        the_excerpt(); 
    endforeach;
    

    Update: (for a custom feed you can use)

    <?php 
    
        if(function_exists('fetch_feed')) {
            // change the url where you put the file,
            // also it may has dependency on otherfiles, so make sure about it.
            include_once(ABSPATH . WPINC . '/feed.php'); 
            $feed = fetch_feed('feedurl');
            $limit = $feed->get_item_quantity(5);
            $items = $feed->get_items(0, $limit);
        }
        if ($limit == 0) echo '<div>The feed is either empty or unavailable.</div>';
        else {
    ?>
        <ul style="margin-bottom:10px">
            <?php foreach ($items as $item) : ?>
            <li>
                <a target="_blank" href="<?php echo $item->get_permalink(); ?>" alt="<?php echo $item->get_title(); ?>"><?php echo $item->get_title(); ?></a>
                <small style="color:gray;display:block;"><?php echo $item->get_date('jS F Y'); ?></small>
            </li>
            <em><?php echo $item->get_date('j F Y'); ?></em>
            <p><?php echo substr($item->get_description(), 0, 200); ?> ...</p>
            <?php endforeach; ?>
        </ul>
    <?php } ?>
    

    P/S: This code is taken from one of my sites, so please adjust it. Also check Codex.