- This topic is empty.
-
AuthorPosts
-
August 27, 2012 at 12:01 pm #39529dynamycMember
I have this part of code:
return '';
What I want to do is to return also a php shortcode but not inside the img element, because my shortcode generates a a element so I need to return it after the img
this is my shortcode:I’ve tried this:
return ''.do_shortcode('[daisy]');
but is not working, I receive:
Error (Parseerror): Syntax Error Unexpected Token <
How can I make this ?
Thanks!August 27, 2012 at 7:36 pm #108560BillyParticipantWhat I understand from the error is that there must be some missing quotes, and it must be in the do_shortcode(‘[daisy]’); bit.
I’m really not sure about this, but try one of these two things:
return ''.echo(do_shortcode('[daisy]'));
// OR
return '' do_shortcode('[daisy]');
I’m quite dubious about this, and thing that if we could see what this do_shortcode() thing is, just to see how the two can be integrated.
August 28, 2012 at 7:53 pm #108647dynamycMemberNope, isn’t working.
Here is the code ( I’m using wordpress) :function custom_slidessc($atts, $content = null) {
$user_agent = $_SERVER["HTTP_USER_AGENT"];
if(strpos($user_agent,'iPhone') || strpos($user_agent,'iPod') || strpos($user_agent,'Android')){ $mobile = true; }else{ $mobile = false; }
$ipad = strpos($user_agent, 'iPad') ? true : false;
$class = shortcode_atts( array('text_color' => '#ffffff', 'image' => '', 'video_vimeo' => '', 'video_youtube' => '', 'video_mp4' => '', 'video_ogg' => '', 'video_webm' => '', 'video_poster' => '', 'slide_desc' => '', 'slide_horizontal' => '', 'slide_fitscreen' => '', 'slide_noresize' => ''), $atts );
/* Slide Description */
if($class != ''){
$slide_desc = $class;
$slide_desc = "title="".$slide_desc.""";
}
/* Slide Text/Cursor Color */
if($class == '#ffffff'){
$text_color = 'text_white';
}else{
$text_color = 'text_black';
}
/*
*/
/*
>>> IMAGE SLIDE <<<
*/
/*
*/
if($class != ''){
$image = $class;
if($class == 'true'){ $horizontal = 'slide_horizontal '; }else{ $horizontal = ''; }
if($class == 'true' || $class == 'true'){ $slide_fitscreen = 'slide_fitscreen'; }else{ $slide_fitscreen = ''; }
return '';
/*
*/
/*
>>> HTML5 VIDEO SLIDE <<<
*/
/*
*/
}elseif(($class != '' or $class != '' or $class != '') AND !$mobile){
$video_mp4 = $class;
$video_ogg = $class;
$video_webm = $class;
if($class != ''){ $video_poster = "poster="".$class."""; }else{ $video_poster = ""; }
return ''.do_shortcode('[video mp4="'.$video_mp4.'" ogg="'.$video_ogg.'" webm="'.$video_webm.'" '.$video_poster.' preload="true"]').'';
/*
*/
/*
>>> YOUTUBE SLIDE <<<
*/
/*
*/
}elseif($class != ''){
$video_youtube = $class;
if($class = 'true'){ $video_noresize = 'height="360" width="640"'; }else{ $video_noresize = 'height="100%" width="100%"'; }
$strText = preg_replace( '/(http|ftp)+(s)?:(//)((w|.)+)(/)?(S+)?/i', 'link', $video_youtube );
if($strText == 'link'){
$array_link_explode = explode('v=', $video_youtube);
$array_link_explode = explode('&', $array_link_explode[1]);
$video_youtube =$array_link_explode[0];
}
$video_poster = $class;
if($mobile){
return '';
}else if($ipad){
if($video_poster){ $ipad_poster = ''; }else{ $ipad_poster = ''; }
return ''.$ipad_poster.'';
}else if($video_poster != ''){
return '';
}else if(!$ipad){ //disable fullscreen for ipad
return '';
}
/*
*/
/*
>>> VIMEO SLIDE <<<
*/
/*
*/
}elseif($class != ''){
$video_vimeo = $class;
if($class = 'true'){ $video_noresize = 'height="360" width="640"'; }else{ $video_noresize = 'height="100%" width="100%"'; }
$strText = preg_replace( '/(http|ftp)+(s)?:(//)((w|.)+)(/)?(S+)?/i', 'link', $video_vimeo );
if($strText == 'link'){
$array_link_explode = explode('.com/', $video_vimeo);
$video_vimeo = $array_link_explode[1];
}
$video_poster = $class;
if($mobile){
return '';
}else if($ipad){
return '';
}else if($video_poster != ''){
return '';
}else if(!$ipad){ //disable fullscreen for ipad
return '';
}
}else{
return false;
}
}
add_shortcode("slide", "custom_slidessc");
?>August 29, 2012 at 3:25 am #108680BillyParticipantOK. I’ll have to pull out here; I’m not much of a PHP guy, and could not really see where the code came from. I can’t answer your question I’m afraid.
-
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.