WordPress.org

Ready to get started?Download WordPress

Forums

Relevanssi - A Better Search
Relevanssi is loading anothers plugins code before (2 posts)

  1. Philipp
    Member
    Posted 1 year ago #

    Hi!

    I might sounds strange but after some testing this issue seems to come through the great Relevanssi Plugin:

    I use the https://github.com/thenextweb/TNW-Social-Count Plugin. The embed code is NOT in the search.php. But as soon someone searches something, the share button gets loaded before the <head>. I checked everything and the only solution was to deactivate Relevanssi?!

    Did someone else face that?

    Best!

    Philipp

    http://wordpress.org/extend/plugins/relevanssi/

  2. Philipp
    Member
    Posted 1 year ago #

    OK. I found the problem. No idear how but it has something to do with a plugin which I wrote. So if one of the result pages has video attachements the Social Count get's loaded?! Crazy!!

    Here's the code of my Plugin:

    function sublime_video_playlist() {
    wp_enqueue_script('sublime_video', '' .plugins_url( '/js/sublime_playlist.js' , __FILE__ ). '');
    
    global $post;
    $return = '';
    
    $attachments = get_children( array(
    				'post_parent'	 => $post->ID,
    				'post_type'      => 'attachment',
    				'numberposts'    => 1, // show all -1
    				'post_status'    => 'inherit',
    				'post_mime_type' => 'video',
    				'order'          => 'ASC',
    				'orderby'        => 'menu_order ASC'
    				) );
    
    if ( $attachments ) {
    
      $return .=   '<div class="sp shadow"><img src="/content/themes/maxx-wp/images/large-seperator.png"></div>';
    
      $return .=   '<div id="playlist1" class="sv_playlist">';
    
      $args = array(
    	'post_type' => 'attachment',
    	'post_mime_type' => 'video',
    	'numberposts' => null,
    	'post_status' => null,
    	'orderby' => 'title',
    	'post_parent'	 => $post->ID
    );
    
    $attachments = get_posts($args);
    
    if ($attachments) {
    	foreach ($attachments as $attachment) {
    		$return .=   '<div class="video_wrap">';
    		$return .=   '<video style="display:none" width="568" height="320" id="video';
    		$return .=   $attachment->ID;
    		$return .=   '" data-settings="autoresize:fit" poster="';
    		$return .=   '" preload="true">';
    		$return .=   '<source src="';
    		$return .=   wp_get_attachment_url ($attachment->ID);
    		$return .=   '" /></video>';
    		$return .=   '</div>';
    
    	}
    
    	$return .=   '<ul class="thumbs">';
    
    $args = array(
    	'post_type' => 'attachment',
    	'post_mime_type' => 'video',
    	'numberposts' => null,
    	'post_status' => null,
    	 'orderby' => 'title',
    	'post_parent' => $post->ID
    );
    $attachments = get_posts($args);
    
    if ($attachments) {
    	foreach ($attachments as $attachment) {
    		$return .=   '<li style="padding:0px;" id="thumbnail_video';
    		$return .=   $attachment->ID;
    		$return .=   '">  <a class="sublime" href="#video';
    		$return .=   $attachment->ID;
    		$return .=   '" href=" "> <img style="height:100%" alt="" src="';
    		$return .=   wp_get_attachment_url( get_post_thumbnail_id($post->ID));
    		$return .=   '" width="144" height="71" /> <span class="play" /> </a> </li>';
    
    }
    } 
    
    	$return .=   '</ul></div>	
    
     <div style="margin-bottom: -19px; float:right">';
    			if(function_exists('render_tnwsc_button')) {
    				$return .=   render_tnwsc_button();
    			}
    	$return .=   '</div>';
    	$return .=   '<div class="sp shadow"><img src="/content/themes/maxx-wp/images/large-seperator.png"></div>';
    return $return;
    }
    }
    }
    add_shortcode('video_playlist', 'sublime_video_playlist');

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags