Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option to not show icons anywhere #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
60 changes: 32 additions & 28 deletions async-share.php
Expand Up @@ -226,43 +226,47 @@ public function display_check( $content ) {
return $content;
}

if ( is_page() ) {
if ( is_array( $options['types'] ) && in_array( 'page', $options['types'] ) ) {
if ( isset( $options['position'] ) && 'above' == $options['position'] ) {
return $above_content;
} else {
return $below_content;
//If set to "nowhere" option, don't try to output the links anywhere.
if(isset($options['position']) && $options['position'] !== 'nowhere')
{
if ( is_page() ) {
if ( is_array( $options['types'] ) && in_array( 'page', $options['types'] ) ) {
if ( isset( $options['position'] ) && 'above' == $options['position'] ) {
return $above_content;
} else {
return $below_content;
}
}
}

return $content;
}
return $content;
}

if ( is_home() || is_paged() ) {
if ( is_array( $options ) && isset( $options['paged'] ) ) {
if ( isset( $options['position'] ) && 'above' == $options['position'] ) {
return $above_content;
} else {
return $below_content;
if ( is_home() || is_paged() ) {
if ( is_array( $options ) && isset( $options['paged'] ) ) {
if ( isset( $options['position'] ) && 'above' == $options['position'] ) {
return $above_content;
} else {
return $below_content;
}
}
}

return $content;
}
return $content;
}

if ( is_single() ) {
if ( is_single() ) {

$cpt = get_post_type();
$cpt = get_post_type();

if ( is_array( $options['types'] ) && in_array( $cpt, $options['types'] ) ) {
if ( isset( $options['position'] ) && 'above' == $options['position'] ) {
return $above_content;
} else {
return $below_content;
if ( is_array( $options['types'] ) && in_array( $cpt, $options['types'] ) ) {
if ( isset( $options['position'] ) && 'above' == $options['position'] ) {
return $above_content;
} else {
return $below_content;
}
}
}

return $content;
return $content;
}
}

return $content;
Expand All @@ -278,7 +282,7 @@ public function display_check( $content ) {
function async_social() {
return Async_Social_Sharing::get_instance();
}
async_social();
$async_social_plugin = async_social();

/**
* Outputs async social sharing for manual display.
Expand Down
7 changes: 5 additions & 2 deletions views/admin-view.php
Expand Up @@ -63,9 +63,12 @@
<label><input name="async_share_options[position]" type="radio" value="above" <?php if ( isset( $options['position'] ) ) {
checked( 'above', $options['position'] );
} ?> /> <?php _e( 'Before the content' ); ?> </label><br />
<input name="async_share_options[position]" type="radio" value="below" <?php if ( isset( $options['position'] ) ) {
<label> <input name="async_share_options[position]" type="radio" value="below" <?php if ( isset( $options['position'] ) ) {
checked( 'below', $options['position'] );
} ?> /> <?php _e( 'After the content' ); ?> </label>
} ?> /> <?php _e( 'After the content' ); ?> </label> <br/>
<label> <input name="async_share_options[position]" type="radio" value="nowhere" <?php if ( isset( $options['position'] ) ) {
checked( 'nowhere', $options['position'] );
} ?> /> <?php _e( 'Nowhere (Use async_social_display() in your theme to display the links.)' ); ?> </label>
</div>
<br />

Expand Down