function pippin_get_image_id($image_url) {
global $wpdb;
$attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s';", $image_url ));
return $attachment[0];
}
// [bartag foo="foo-value"]
function bartag_func( $atts ) {
$a = shortcode_atts( array(
'foo' => 'something',
'bar' => 'something else',
), $atts );
global $wpdb, $strreplace;
$attachment = $wpdb->get_col($wpdb->prepare("SELECT thumbnail FROM groznyi.wp_nextend2_smartslider3_slides WHERE slider=".$atts['slider'].";" ));
$str="";
foreach ($attachment as &$value) {
$str = $str.pippin_get_image_id(str_replace ("\$upload\$", "http://www4.sb-dc.ru/wp-content/uploads", $value)).",";
}
$strreplace='[gallery columns="4" link="file" ids='.$str.']';
return '[gallery columns="4" link="file" ids='.$str.']';
}
add_shortcode( 'smartslider3', 'bartag_func' );
$content = get_the_content ();
the_content();
do_shortcode($content);?>
wordpress smartslider3 to gallery
Подписаться на:
Сообщения
(
Atom
)