WordPress.org

Forums

Digg Digg
[resolved] Disable Digg-Digg on Three Pages (18 posts)

  1. jefffffffrey91
    Member
    Posted 2 years ago #

    I love Digg-Digg, the problem is that it doesn't work on just three pages of my wordpress site because of script/plugin conflicts.

    Is there anyway to manually disable the plugin on just these three pages?

    http://wordpress.org/extend/plugins/digg-digg/

  2. leojonathanoh
    Member
    Posted 2 years ago #

    Would like to know too. I want to disable digg digg in certain pages but there is no options to do so.

  3. jnscollier
    Member
    Posted 2 years ago #

    Yeah, no kidding. How do I EXCLUDE the damn DIGG DIGG bar from showing up on certain pages?

    Developers, think about this for a second and understand why this feature is so important...

    Say you have a private digital download page that customers reach after check-out.

    Do you really want the DIGG DIGG bar showing up for people to share that page all over the internet?

    Pretty common sense stuff.

    I suggest adding functionality to exclude pages based on their page ID. User enters page ID's to exclude and the plugin performs an

    if(is_page(123)) {don't show} else {show}

  4. MarketingNinjas
    Member
    Posted 2 years ago #

    Guys, this is essential. With Digg Digg prior to you taking it over we were able to drop code into the page to disable it on that page. We NEED this. Especially for us Internet marketers that are trying to build lists offering premium content. We don't want that shared.

    My wish: Allow us to change the specific URL that's being shared on that page. What I mean is if you're on a success page to download premium content, allow us to put in a custom URL to the landing page where the lead capture form was (the page prior to this one). That way we can still allow people to share it, only it's sharing the landing page not the success page.

    We do this now, but we have to hard code in the sharing button to do it and it doesn't look pretty.

    Please, please, please add this feature. Would be a life saver.

  5. Glen Thomson
    Member
    Posted 2 years ago #

    A possible work around is to use a plugin called 'Plugin Organizer'.

    This allows you to disable a plugin site-wide and then activate it again on individual posts and pages.

    It's a convoluted way of achieving what you need I agree, but at least it gives the desired end result: digg digg on some pages and not others.

    http://wordpress.org/extend/plugins/plugin-organizer/

    Hope this helps!
    Glen

  6. DaveBurns
    Member
    Posted 2 years ago #

    All -

    Looking through the code, this feature already exists but is not documented anywhere so beware: it could go away with a future update. That said, it's really easy to use. Just insert this HTML comment into your page/post content:

    <!-- Digg Digg Disabled -->

    It worked just fine for me.

    db

  7. socialrich
    Member
    Posted 2 years ago #

    Dave,

    Awesome solution!

    You can actually see the bar quickly but it then disappears. I had to remove it from this page where a FAQ plugin was interfering.

    You can check it out here: http://theseosystem.com/the-seo-system-faqs/

    Thanks!

    Regards,
    Richard

  8. Andrew Yates
    Member
    Plugin Author

    Posted 2 years ago #

    This is now documented within the FAQ. Thanks for posting that solution Dave.

  9. DaveBurns
    Member
    Posted 2 years ago #

    @socialrich - I'm surprised you see the bar quickly. From what I see in the code, it should never show in the first place.

    BTW, I can't find the thread but someone asked somewhere about how to adjust the vertical position of the bar on certain pages. I have a patch that does this via custom fields so you can control it per post. Let me know if interested.

    db

  10. neocorps
    Member
    Posted 2 years ago #

    @DaveBurns - I'm interested in controling the horizontal and vertical position in certain pages (I'm using woocommerce and the bar conflicts with the sidebar of my template), Is there a way to do that?

  11. DaveBurns
    Member
    Posted 2 years ago #

    @neocorps - I have my code modified here to allow optionally overriding the default vertical positioning. I didn't need horizontal control but it should be easy enough using the same approach. The way I did it to minimize effort was to use the existing Custom Fields mechanism - I did not create a pretty UI. I have it so that you can specify one or both of

    dd_override_start_anchor_id
    and
    dd_override_top_offset

    The first lets you override the HTML element used to align the bar vertically. The second lets you override the offset to the anchor position. You can use both at once too.

    I'm not sure the best way to share my changes with people other than through the officially requested way of forking the GitHub repo. I'll try to get to that later this week. Other suggestions welcome.

    db

  12. neocorps
    Member
    Posted 2 years ago #

    @DaveBurns - Thanks for the reply. Could you post an example of what you did with the dd_override_start_anchor_id ?

    I could probably modify WooCommerce product page to display it correctly.

  13. DaveBurns
    Member
    Posted 2 years ago #

    @neocorps - Not quite sure what you're asking. The dd_override_start_anchor_id is a mechanism I added in the code. Once that was added, I go to edit that page, scroll down to Custom Fields and add dd_override_start_anchor_id as a field name. Then as a value, I give the ID of the HTML element I want it to align to. In my case, "header-container" but yours will surely be different.

    Does that make sense? Seems to me that you'd need the actual code changes to make use of this. Unless you're a coder as well and are going to dive in.

    [Might make sense to move this to a new thread, btw.]

  14. neocorps
    Member
    Posted 2 years ago #

    @DaveBurns - Yes I will need the code of the mechanism. I'm not a very proficient in codig haha.

    I will not be using Custom Fields cause I know exactly what pages I need this to work differently, so I just need the code to override the start anchor id and the top offset inside the template.

    Check my Website http://4dageek.com/tienda/ and click on a product, you will see my problem.

  15. DaveBurns
    Member
    Posted 2 years ago #

    I see your problem. If you're not interested in my code changes themselves, you'll want to look at two files in the plugin:

    wp-content/plugins/digg-digg/digg-digg.php around line 342
    and
    wp-content/plugins/digg-digg/js/diggdigg-floating-bar.js around line 8 and 15.

    Good luck.

  16. neocorps
    Member
    Posted 2 years ago #

    Alright, I'll give them a look, thanks!

  17. DaveBurns
    Member
    Posted 2 years ago #

    FWIW, I have just sent a pull request to the digg-digg authors with code that lets you control the vertical positioning of the floating bar on individual pages. Maybe they will include it in a future version.

  18. Balbir Kaur
    Member
    Posted 2 years ago #

    Use the following code in functions.php

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    add_action( 'add_meta_boxes', 'meta_box_digg' );
    function meta_box_digg()
    {
        add_meta_box( 'digg-meta-box-id', 'Social Networking Effect ShortCode', 'wpt_digg_effect', 'page', 'side', 'default' );
    	$post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;
    
    }
    
    function wpt_digg_effect() {
    	global $post;
    	// Noncename needed to verify where the data originated
    	echo '<input type="hidden" name="eventmeta_noncename" id="eventmeta_noncename" value="' .
    	wp_create_nonce( plugin_basename(__FILE__) ) . '" />';
    	// Get the location data if its already been entered
    	$diggeffect = get_post_meta($post->ID, '_diggeffect', true);
    	// Echo out the field
    	echo '<input type="checkbox"' . (!empty($diggeffect) ? ' checked="checked" ' : null) . 'value="'.$post->post_name.'" name="_diggeffect" /> Publish social networking icons</label>';
    	echo "";
    	echo "Tick on checkbox if you want social networking widget on this page. ";
    	echo '<span style="color:#BC2C2C;font-weight:bold;"></font>';
    }
    // Save the Metabox Data
    function wpt_save_events_meta($post_id, $post) {
    
    	// verify this came from the our screen and with proper authorization,
    	// because save_post can be triggered at other times
    	if ( !wp_verify_nonce( $_POST['eventmeta_noncename'], plugin_basename(__FILE__) )) {
    	return $post->ID;
    	}
    
    	// Is the user allowed to edit the post or page?
    	if ( !current_user_can( 'edit_post', $post->ID ))
    		return $post->ID;
    
    	// OK, we're authenticated: we need to find and save the data
    	// We'll put it into an array to make it easier to loop though.
    	 $diggeffected=stripslashes($_POST['_diggeffect']);
    
    	$events_meta['_diggeffect'] = $diggeffected;
    
    	// Add values of $events_meta as custom fields
    
    	foreach ($events_meta as $key => $value) { // Cycle through the $events_meta array!
    		if( $post->post_type == 'revision' ) return; // Don't store custom data twice
    		$value = implode(',', (array)$value); // If $value is an array, make it a CSV (unlikely)
    		if(get_post_meta($post->ID, $key, FALSE)) { // If the custom field already has a value
    			update_post_meta($post->ID, $key, $value);
    		} else { // If the custom field doesn't have a value
    			add_post_meta($post->ID, $key, $value);
    		}
    		if(!$value) delete_post_meta($post->ID, $key); // Delete if blank
    	}
    
    }
    
    add_action('save_post', 'wpt_save_events_meta', 1, 2); // save the custom fields
    
    function my_include_digg_digg() {
    	global $post;
    	$select_digg="SELECT * FROM <code>wp_postmeta</code> WHERE meta_key = '_diggeffect'";
    	$digg_query=mysql_query($select_digg);
    	$digg_num=mysql_num_rows($digg_query);
    	if($digg_num>0){
    		while($digg_execu=mysql_fetch_array($digg_query))
    		{
    			$pageslug_digg[]=$digg_execu['meta_value'];
    			$array_count=count($pageslug_digg);
    		}
    		foreach( $pageslug_digg as $key => $value){
    			if($post->post_name==$value) {
    				if(is_page($value)){
    					add_filter('the_excerpt', 'dd_hook_wp_content');
    					add_filter('the_content', 'dd_hook_wp_content');
    				}
    			}
    			else{
    			 remove_filter('the_excerpt', 'dd_hook_wp_content');
    			 remove_filter('the_content', 'dd_hook_wp_content');
    			}
    		}
    	}
    }
    add_action('template_redirect', 'my_include_digg_digg');

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Digg Digg
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.