1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

1.7 Php Code For New Or Top Post's Links!

Discussion in 'General Troubleshooting' started by masih, Dec 19, 2016.

  1. masih

    masih New Member

    Hi,
    i want to show NEW and TOP posts with marquee tag .

    the ideas is that i want to show TOP posts link in one line with movement from right to left . and sticky in down screen.

    so i need a PHP code to get TOP posts links. just name and page link is enough!
     
  2. valMETNG

    valMETNG Administrator Staff Member Admin

    I'm not sure if I'm understanding the PHP code you're looking for but the bookmarking plugin might be your best place to look for example code. The hotaru_posts table in the database has a column called post_status that is set to 'top' for top posts. When the bookmarking plugin runs for the front page, it executes function prepareListFilters (line 163 of /plugins/bookmarking/libs/BookmarkingFunctions.php) and uses a filter for post_status = 'top' (line 232). You can use that as a potential starting point for how to write your own code.

    However, you could also create your own query of the database directly by doing something like this:
    Code:
    $sql = "SELECT post_id, post_title, post_orig_url FROM " . TABLE_POSTS . " WHERE post_status = %s";
    $posts= $h->db->get_results($h->db->prepare($sql, 'top'));
     
    masih likes this.

Share This Page