Hi Friends,
I have a added this shortcode to a child themes functions.php file. But it is simply outputting [current crn] when I put it in a Grid Row in the ALB.
It works fine in the regular editor. Please guide me to the best way to make it work in ALB.
Thanks!
The shortcode is below.
// Add Shortcode
function current_crn() {
// Code
switch_to_blog (7);
$args=array(
'tag' => 'cerp',
'showposts'=>10,
'caller_get_posts'=>1
);
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
echo '10 recent Posts with CCC Tag';
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<ul><li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a><p><?php the_post_thumbnail( 'widget', array( 'class' => 'alignleft profile-img' ) ); ?><?php the_excerpt(); ?></p></li></ul>
<?php
endwhile;
} //if ($my_query)
wp_reset_query(); // Restore global post data stomped by the_post().
restore_current_blog();
}
add_shortcode( 'curent crn', 'current_crn' );
Hi – Any help please?
Hey!
This would have to be considered custom work. It would be best to hire a freelancer to help you out with advanced customizations like these.
Looking over your code though I noticed a typo here.
add_shortcode( 'curent crn', 'current_crn' );
Regards,
Elliott