0

I would like to add a custom "trending topics" section to my news website at the top of the homepage. An existing example that shows precisely what I am looking for is the Daily Beast homepage.

I would like to do this with custom code or with a plugin, but not as a widget. Does anyone know how I can do this in a flexible way that can easily customize to style and look of my website.

My site is a Spanish language 24/7 news website called Yasta.pr. Thx!

1 Answers1

0

it depends on how you are storing your data in your database but you can try this:

add a div section in the header of your webpage above the menu bar.

then you can dynamically add the most trending topic to it automatically when the page starts by inserting this code inside it:

<div id="*id_name">

$query = "SELECT * FROM *table_name ORDER BY *most_trending_column LIMIT 1";
mysql_select_db(*database_name, *connection);
$result = mysql_query($query) or die(mysql_error());
$data = mysql_fetch_assoc($result);
echo "<h3 id='*id_name'>" . $data['*title_column_name'] . "</h3>";

</div>

dont forget to connect to your database first.

razz
  • 9,770
  • 7
  • 50
  • 68