שאל שאלה
1 |
אני מנסה כבר כמה שעות לעשות קיצור קוד שכולל loop של wp query ולא הולך!
הנה הקוד לדוגמה:
add_shortcode('recentposts', 'my_recent_posts');
function my_recent_posts($atts, $content = null) {
extract(shortcode_atts(array(
"amount" => '10',
"classes" => '',
), $atts));
$muargs = array(
'posts_per_page' => $amount
);
$muQuery = new WP_Query($muargs);
echo '<ul>';
while($faqQuery->have_posts()) {
$faqQuery->the_post();
echo '<li><a href="'.get_permalink().'">'.get_the_title().'</a></li>';
}
echo '</ul>';
wp_reset_postdata();
}
אפשר עזרה? (אני רוצה גם להבין למה זה לא הולך)
מאת דורי
בתאריך 13-02-2014
תגובה אחת