Forum Replies Created

Viewing 15 replies - 181 through 195 (of 218 total)
  • Thread Starter Matt

    (@syntax53)

    I cannot as I am developing a new site that isn’t accessible externally yet. I did try adding the actual widget and it did not work either.

    Thread Starter Matt

    (@syntax53)

    That’s why I was hoping you could implement it into future release =D. Why not provide the additional option? Failing to see any negative to it.

    Thread Starter Matt

    (@syntax53)

    Figured out a way to loop through widget data to provide a permanent fix. This will make it still only load scripts when necessary and will only check widget data when not found in post data. The only thing I’m not sure of is if a home page is set to “static,” will “add_filter( ‘the_posts’, array( $this, ‘load_scripts’ ) );” still fire? I assume so. Anyways, here is my fix:

    First the function to check the widget data. I inserted this just above the load_scripts function:

    public function active_in_widget() {
    	global $wp_registered_widgets;
    	$active_widgets = get_option( 'sidebars_widgets' );
    	foreach ( $active_widgets as $sidebar_name => $sidebar_widgets ) {
    		if ($sidebar_name != 'wp_inactive_widgets' && !empty($sidebar_widgets) && is_array($sidebar_widgets)) {
    			foreach ($sidebar_widgets as $widget_instance) {
    				$widget_class = $wp_registered_widgets[$widget_instance]['callback'][0]->option_name;
    				$instance_id = $wp_registered_widgets[$widget_instance]['params'][0]['number'];
    				$widget_data = get_option($widget_class);
    				if (!empty($widget_data[$instance_id]['text'])) {
    					if (stripos( $widget_data[$instance_id]['text'], '[gcal' ) !== false) return TRUE;
    				}
    			}
    		}
    	}
    	return FALSE;
    }

    And then the modification to load_scripts:

    public function load_scripts( $posts ) {
    	$load_scripts = FALSE;
    
    	if ( !empty( $posts ) ) {
    		foreach ( $posts as $post ){
    			if ( ( strpos( $post->post_content, '[gcal' ) !== false ) || ( $post->post_type == 'gce_feed' ) ) {
    				$load_scripts = TRUE;
    				break;
    			}
    		}
    	}
    
    	if (!$load_scripts) {
    		if ($this->active_in_widget()) $load_scripts = TRUE;
    	}
    
    	if ($load_scripts) {
    		// Load CSS
    		wp_enqueue_style( $this->plugin_slug . '-public' );
    
    		// Load JS
    		wp_enqueue_script( $this->plugin_slug . '-public' );
    
    		$this->show_scripts = true;
    	}
    
    	return $posts;
    }
    Thread Starter Matt

    (@syntax53)

    The issue for me was the height of the containing box. I like how with the widget styling it’s condensed and small. I also use display=”grid” on other pages and like the styling of those as they are. I would have to add extra css styling for something like “.widget .gce-page-grid” but .gce-widget-grid already has the exact styling I want.

    Seems easy enough to implement my code fix, no?

    Thread Starter Matt

    (@syntax53)

    Wow I just went back to read this and I butchered the hell out of this post. I meant to say, “I recently had a need to customize the widget…” and then “I was hoping I could do ‘display=widget‘” (not grid, which obviously works). Either way, the fix I posted does work and enbles display=widget as an option.

    Thread Starter Matt

    (@syntax53)

    Line 383 in wp-media-cleaner.php. If you search for “$wpmc_exclude_dir” it’s the first match.

    $wpmc_exclude_dir = array( ".", "..", "wpmc-trash", ".htaccess", "ptetmp", "profiles", "sites" );

    Thread Starter Matt

    (@syntax53)

    This did not got fixed in your latest version.

    Thread Starter Matt

    (@syntax53)

    wow, ok. I tracked it back even further to another custom function that I wrote where I was hooking “pre_get_posts” to add pages to the loop, but only if they were 1 month old or newer. I just had to modify that query to include the table name ($wpdb->prefix.’posts’). I guess you are also hooking that somewhere? Either way, ignore my ramblings I suppose ??

    Thread Starter Matt

    (@syntax53)

    fyi– i tried updating to the latest development version and it did not fix it.

    Thread Starter Matt

    (@syntax53)

    So it is being caused by the shortcode I thought it was, but not when displayed directly on the page. It’s being caused by a custom function I wrote that creates an excerpt from the content of the page when “get_the_excerpt()” returns nothing in a list of recent posts. My function is as follows–

    function custom_excerpt_length($length){
    	$excerpt = do_shortcode( get_the_content() );
    	$excerpt = strip_tags($excerpt, '<br><li><p>');
    	$excerpt = str_ireplace(array('<br>'), array(', '), $excerpt);
    	$excerpt = str_ireplace(array('<li>','</li>'), array(', ', ''), $excerpt);
    	$excerpt = str_ireplace(array('<p>','</p>'), array(', ', ''), $excerpt);
    	while (substr($excerpt, 0, 1) == ',') { $excerpt = substr($excerpt, 1); }
    	$excerpt = trim($excerpt);
    	if (strlen($excerpt) > $length) {
    		$permalink = get_permalink();
    		$excerpt = substr($excerpt, 0, $length);
    		$excerpt = substr($excerpt, 0, strripos($excerpt, " "));
    		$excerpt = trim(preg_replace( '/\s+/', ' ', $excerpt));
    		$excerpt = $excerpt.'... <a href="'.$permalink.'">more</a>';
    	}
    	return $excerpt;
    }

    The “$excerpt = do_shortcode( get_the_content() );” is causing it. This is being ran in the loop on a homepage set to show the most recent posts. The shortcode is–

    [mla_gallery mla_link_attributes=’rel=”none”‘ attachment_category=board-governance mla_style=mla-policy-list-ul mla_markup=mla-policy-list-ul post_parent=all orderby=title order=asc post_mime_type=all link=file]

    Thread Starter Matt

    (@syntax53)

    post edited — I was wrong, the shortcode i originally posted was not causing this. trying to figure out what is.

    Thread Starter Matt

    (@syntax53)

    I think I identified the problem. In ‘relevanssi_index_doc’ you have the following:

    if (true == apply_filters('relevanssi_do_not_index', false, $post->ID)) {
    	// filter says no
    	if ($post_was_null) $post = null;
    	if ($previous_post) $post = $previous_post;
    	$index_this_post = false;
    }
    
    if ($remove_first) {
    	// we are updating a post, so remove the old stuff first
    	relevanssi_remove_doc($post->ID, true);
    	if (function_exists('relevanssi_remove_item')) {
    		relevanssi_remove_item($post->ID, 'post');
    	}
    }

    Since I’m dealing with an attachment here, and I’m uploading the attachment via the media library section on the dashboard (not from a post or page), the global $post would be null and therefor gets set back to null with “if ($post_was_null) $post = null;”.

    Then during second part you aren’t checking the status of $post. Nor do you do so within the relevanssi_remove_doc function. So $post->ID gets passed through as null.

    I modified the code to this for now on my end–

    if ($remove_first && !empty($post->ID)) {
    	// we are updating a post, so remove the old stuff first
    	relevanssi_remove_doc($post->ID, true);
    	if (function_exists('relevanssi_remove_item')) {
    		relevanssi_remove_item($post->ID, 'post');
    	}
    }
    Thread Starter Matt

    (@syntax53)

    bump

    Thread Starter Matt

    (@syntax53)

    I’m anal and when I fix a link I want the “bubble” to go away ??

    Thread Starter Matt

    (@syntax53)

Viewing 15 replies - 181 through 195 (of 218 total)