Forums WoW Modding Support Archives TrinityCore Discord Archives [DiscordArchive] it's true?

[DiscordArchive] it's true?

[DiscordArchive] it's true?

Pages (2): Previous 1 2
rektbyfaith
Administrator
0
01-04-2023, 03:42 PM
#11
Archived author: Guybrush • Posted: 2023-01-04T15:42:46.526000+00:00
Original source

```php


function wpb_rand_posts()
{
$args = array(
'post_type' => 'post',
'orderby' => 'rand',
'posts_per_page' => 5,
'cat' => 418, // dungeon category
);

$the_query = new WP_Query($args);

if (!$the_query->have_posts()) {
return "No posts found";
}

// actually randomize
shuffle($the_query->posts);


$string .= '<ul>';
while ($the_query->have_posts()) {
$the_query->the_post();
$string .= '<li><a href="' . get_permalink() . '">' . get_the_title() . '</a></li>';
}
$string .= '</ul>';
wp_reset_postdata();


return $string;

}

add_shortcode('wpb-random-posts', 'wpb_rand_posts');
add_filter('widget_text', 'do_shortcode');
```
rektbyfaith
01-04-2023, 03:42 PM #11

Archived author: Guybrush • Posted: 2023-01-04T15:42:46.526000+00:00
Original source

```php


function wpb_rand_posts()
{
$args = array(
'post_type' => 'post',
'orderby' => 'rand',
'posts_per_page' => 5,
'cat' => 418, // dungeon category
);

$the_query = new WP_Query($args);

if (!$the_query->have_posts()) {
return "No posts found";
}

// actually randomize
shuffle($the_query->posts);


$string .= '<ul>';
while ($the_query->have_posts()) {
$the_query->the_post();
$string .= '<li><a href="' . get_permalink() . '">' . get_the_title() . '</a></li>';
}
$string .= '</ul>';
wp_reset_postdata();


return $string;

}

add_shortcode('wpb-random-posts', 'wpb_rand_posts');
add_filter('widget_text', 'do_shortcode');
```

rektbyfaith
Administrator
0
01-04-2023, 03:42 PM
#12
Archived author: Guybrush • Posted: 2023-01-04T15:42:57.569000+00:00
Original source

offered some unsolicited refactoring for you
rektbyfaith
01-04-2023, 03:42 PM #12

Archived author: Guybrush • Posted: 2023-01-04T15:42:57.569000+00:00
Original source

offered some unsolicited refactoring for you

rektbyfaith
Administrator
0
01-04-2023, 03:43 PM
#13
Archived author: Guybrush • Posted: 2023-01-04T15:43:14.040000+00:00
Original source

but it's still doing inline html, which is gross even for wordpress
rektbyfaith
01-04-2023, 03:43 PM #13

Archived author: Guybrush • Posted: 2023-01-04T15:43:14.040000+00:00
Original source

but it's still doing inline html, which is gross even for wordpress

rektbyfaith
Administrator
0
01-04-2023, 03:43 PM
#14
Archived author: Guybrush • Posted: 2023-01-04T15:43:17.936000+00:00
Original source

but w/e
rektbyfaith
01-04-2023, 03:43 PM #14

Archived author: Guybrush • Posted: 2023-01-04T15:43:17.936000+00:00
Original source

but w/e

rektbyfaith
Administrator
0
01-04-2023, 03:56 PM
#15
Archived author: blacknightt • Posted: 2023-01-04T15:56:53.177000+00:00
Original source

does not work right
rektbyfaith
01-04-2023, 03:56 PM #15

Archived author: blacknightt • Posted: 2023-01-04T15:56:53.177000+00:00
Original source

does not work right

rektbyfaith
Administrator
0
01-04-2023, 03:58 PM
#16
Archived author: Guybrush • Posted: 2023-01-04T15:58:36.335000+00:00
Original source

what does it do exactly
rektbyfaith
01-04-2023, 03:58 PM #16

Archived author: Guybrush • Posted: 2023-01-04T15:58:36.335000+00:00
Original source

what does it do exactly

Pages (2): Previous 1 2
Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)