Jump to content
Guest AndreiMihai

Opinie design site

Recommended Posts

Guest AndreiMihai
http://raleks.com/ Cum vi se pare?. Nu stie cineva daca/cum pot sa fac ca sa fie imaginile alea care se deplaseaza aleatoriu? (este facut cu wordpress), ele vin in ordinea postarilor si as vrea sa fie ceva aleatoriu din fiecare categorie. Abia azi am inceput sa il fac, mai am multe de bagat pe acolo, dar asa ca inceput cum vi se pare?.
Link to comment
Share on other sites

Guest AndreiMihai

Ceea ce vreau eu sa fac este sa pun mai multe desene/seriale/filme/povesti si din astea, mai vechi, cand erau frumoase fara balauri, monstrii, draci si toate astea + ca ne mai amintim de vremurile frumoase unii :D.....mai lucrez la aspect inca la mine pe calculator, dar e frumos si asa simplu, nu?

Link to comment
Share on other sites

Functia pt random din categoria x

<?php 
function get_catID_by_name($nume_categorie)
{
$query = "SELECT * FROM wp_terms
WHERE name = " . $nume_categorie;
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
return $row['term_id'];
}
function get_posts_category($category_id) {
$counter = 0;
$query = "SELECT * FROM wp_posts
JOIN wp_term_relationships
ON wp_term_relationships.object_id = wp_posts.ID
WHERE wp_term_relationships.term_taxonomy_id = " . $category_id;
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result)){
$array_posts[$counter]['titlu'] = $row['post_title'];
$array_posts[$counter]['content'] = $row['post_content'];
$counter++;
}
return $array_posts;
}

?>

Div-ul pentru a afisa posturile

		<div class="post"><?php //echo get_posts_category(5); 
$posturi = get_posts_category(5);
print_r($posturi[(rand()%count($posturi))]['titlu']);
echo "<br />";
print_r($posturi[(rand()%count($posturi))]['content']);
?></div>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...