Strict Standards: Redefining already defined constructor for class bbdb in /home/themes/public_html/forums/bb-includes/db-mysql.php on line 12

Strict Standards: Declaration of BB_Walker_Blank::start_lvl() should be compatible with BB_Walker::start_lvl($output) in /home/themes/public_html/forums/bb-includes/classes.php on line 1127

Strict Standards: Declaration of BB_Walker_Blank::end_lvl() should be compatible with BB_Walker::end_lvl($output) in /home/themes/public_html/forums/bb-includes/classes.php on line 1127

Strict Standards: Declaration of BB_Walker_Blank::start_el() should be compatible with BB_Walker::start_el($output) in /home/themes/public_html/forums/bb-includes/classes.php on line 1127

Strict Standards: Declaration of BB_Walker_Blank::end_el() should be compatible with BB_Walker::end_el($output) in /home/themes/public_html/forums/bb-includes/classes.php on line 1127
An OOOOPS!!! function mistake concerning featured posts « ThemeShaper Forums

ThemeShaper Forums » Thematic

[closed]

An OOOOPS!!! function mistake concerning featured posts

(7 posts)
  • Started 4 years ago by 4rederick
  • Latest reply from 4rederick
  • This topic is resolved

  1. Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512


    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512
    4rederick

    Member

    With the help of Helga from this post (http://forums.themeshaper.com/topic/adding-function-to-home-page-only-headache) I was able to create a featured-post div on my front page. Unfortunately, the way I used the function seems to be resulting in having everything below the featured-post div in my html to carry the link to the featured post (for example, try clicking on my footer). Not too familiar with php yet, so I'm having a bit of trouble finding the error. Here is my the related function in my functions.php, followed by my home-page-template, which also might be a cause for the error. Probably a simple fix. Thanks ... Love this forum ...

    //==================== START Add featured posts on home page ====================
    function featured_posts(){

    if (is_front_page()) {

    $my_query = new WP_Query('tag=featured&showposts=1');

    echo '<div id="featured-posts">';
    $feat_class = array();

    while ($my_query->have_posts()) : $my_query->the_post();
    $feat_class = array();
    // Category for the post queried
    foreach ( (array) get_the_category() as $cat )
    $feat_class[] = 'category-' . $cat->slug;
    $feat_class = join(" ", $feat_class);
    ?>
    <div id="featured-<?php the_ID(); ?>" class="<?php echo $feat_class; ?>">
    <?php
    $posttitle = '<h4>featured... <a href="';
    $posttitle .= get_permalink();
    $posttitle .= '" title="';
    $posttitle .= __('Permalink to ', 'thematic') . the_title_attribute('echo=0');
    $posttitle .= '" rel="bookmark">';
    $posttitle .= get_the_title();
    $posttitle .= "</h4>\n";
    echo $posttitle;

    //get_the_image();
    the_excerpt();
    ?>

    </div><!-- .post -->
    <?php
    endwhile;
    echo '</div>';

    }

    }
    add_action('thematic_abovecontainer','featured_posts');
    //==================== END Add featured posts on home page ====================

    HERE IS MY HOME PAGE TEMPLATE

    <?php
    /*
    Template Name: Home
    */
    ?>

    <?php

    // calling the header.php
    get_header();

    // action hook for placing content above #container
    thematic_abovecontainer();

    ?>

    <div id="container">

    </div><!-- #container -->

    <?php

    // calling footer.php
    get_footer();

    ?>

    Posted 4 years ago #

  2. Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512


    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512
    helgatheviking

    Moderator

    i think you forgot to reset the query. try adding:

    wp_reset_query();

    just after the endwhile

    http://codex.wordpress.org/Function_Reference/wp_reset_query

    this is why i always use get_posts.

    Posted 4 years ago #

  3. Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512


    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512
    4rederick

    Member

    Sadly that doesn't work either ...

    //==================== START Add featured posts on home page ====================
    function featured_posts(){

    if (is_front_page()) {

    $my_query = new WP_Query('tag=featured&showposts=1');

    echo '<div id="featured-posts">';
    $feat_class = array();

    while ($my_query->have_posts()) : $my_query->the_post();
    $feat_class = array();
    // Category for the post queried
    foreach ( (array) get_the_category() as $cat )
    $feat_class[] = 'category-' . $cat->slug;
    $feat_class = join(" ", $feat_class);
    ?>
    <div id="featured-<?php the_ID(); ?>" class="<?php echo $feat_class; ?>">
    <?php
    $posttitle = '<h4>featured... <a href="';
    $posttitle .= get_permalink();
    $posttitle .= '" title="';
    $posttitle .= __('Permalink to ', 'thematic') . the_title_attribute('echo=0');
    $posttitle .= '" rel="bookmark">';
    $posttitle .= get_the_title();
    $posttitle .= "</h4>\n";
    echo $posttitle;

    //get_the_image();
    the_excerpt();
    ?>

    </div><!-- .post -->
    <?php
    endwhile;
    wp_reset_query();
    echo '</div>';

    }

    }
    add_action('thematic_abovecontainer','featured_posts');

    Posted 4 years ago #

  4. Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512


    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512
    4rederick

    Member

    Thanks, Helga. I'm going to attempt to do this with get_posts. This post looks like it will help a lot: http://forums.themeshaper.com/topic/adding-a-list-of-recent-posts-to-a-custom-page-template#post-18192

    Posted 4 years ago #

  5. Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512


    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512
    4rederick

    Member

    Yay! Feels so much better when you figure something out for yourself. Geesh, I might be learning something ;-)

    I removed the lines from functions.php and edited my page template as so ... seems to be working. Clean enough?

    <?php
    /*
    Template Name: Home
    */
    ?>

    <?php

    // calling the header.php
    get_header();

    // action hook for placing content above #container
    thematic_abovecontainer();

    ?>

    <div id="featured-post">
    <?php
    $args = array( 'posts_per_page' => 1, 'order'=> 'DESC', 'orderby' => 'date' );
    $postslist = get_posts( $args );
    foreach ($postslist as $post) : setup_postdata($post); ?>
    <div>
    <span class="date"><?php the_date(); ?></span>
    " id="post-<?php the_ID(); ?>"><?php the_title(); ?>
    <?php the_excerpt(); ?>

    </div>
    <?php endforeach; ?>
    </div>

    <div id="container">

    </div><!-- #container -->

    <?php

    // calling footer.php
    get_footer();

    ?>

    Posted 4 years ago #

  6. Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512


    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512
    helgatheviking

    Moderator

    i know you are supposed to be able to use new WP_Query, but i have a lot fewer issues w/ get_post. congrats on solving it. don't forget to mark as resolved.

    Posted 4 years ago #

  7. Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512


    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512
    4rederick

    Member

    Though I kind of like it sorted by date now, I was curious to know how I'd sort by category. Say I only wanted the posts from the category Smelly, how would I do that? If it's not a simple solution, don't worry about it. I'm sure I'll figure it out when I need it.

    Posted 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.


Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method GA_Filter::spool_analytics() should not be called statically in /home/themes/public_html/forums/bb-includes/wp-functions.php on line 586

Strict Standards: Non-static method GA_Filter::spool_this() should not be called statically in /home/themes/public_html/forums/my-plugins/googleanalytics.php on line 183