Cannot redeclare get_header() on External Page post call
-
I’m currently getting a ‘Cannot Redeclare get_header() error’ (see below) when I try pulling posts onto an external page using the following code:
<?php /* Short and sweet */ define('WP_USE_THEMES', false); require('./lsutv/wp-blog-header.php'); ?> <?php global $post; $args = array( 'posts_per_page' => 4 ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); ?> <a href="<?php the_permalink() ?>" rel="bookmark" class="video_title" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a><br /> <?php the_excerpt(); ?><hr/> <?php endforeach; ?></div>
Here’s the error:
PHP Fatal error: Cannot redeclare get_header() (previously declared in main\media\label\core\init.php:51) in main\media\lsutv\wp-includes\general-template.php on line 36
When the code is used as a stand alone php file, it pulls the posts perfectly, but as soon as I add it to the page I need the posts to show on (a page ‘above’ the WP site). There anything I can try / do?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Cannot redeclare get_header() on External Page post call’ is closed to new replies.