• Resolved Robert

    (@e2robert)


    As some websites uses custom <meta name=”viewport” in their themes, your plugin might interfere & produce duplicate output in this regard.

    I added another checkbox-option to your plugin. Could you be so kind and incorporate this patch?

    Index: wp-content/plugins/appbanners/appBanners-admin.php
    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
    ===================================================================
    --- wp-content/plugins/appbanners/appBanners-admin.php	(revision 8)
    +++ wp-content/plugins/appbanners/appBanners-admin.php	(revision 9)
    @@ -35,6 +35,7 @@
     	    register_setting(APP_BANNERS_ID . '_options', 'APP_BANNERS_appStoreLanguage');
     	    register_setting(APP_BANNERS_ID . '_options', 'APP_BANNERS_ms_application_id');
     	    register_setting(APP_BANNERS_ID . '_options', 'APP_BANNERS_ms_application_package_name');
    + 	    register_setting(APP_BANNERS_ID . '_options', 'APP_BANNERS_printViewPort');
         }
    
         public static function menu() {
    @@ -65,6 +66,7 @@
             $appStoreLanguage = get_option('APP_BANNERS_appStoreLanguage');
     	    $msApplicationID = get_option('APP_BANNERS_ms_application_id');
     	    $msApplicationPackageName= get_option('APP_BANNERS_ms_application_package_name');
    + 	    $printViewPort = get_option('APP_BANNERS_printViewPort', true);
    
             require_once dirname(__FILE__) . '/tpl/admin-options.php';
         }
    Index: wp-content/plugins/appbanners/tpl/admin-options.php
    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
    ===================================================================
    --- wp-content/plugins/appbanners/tpl/admin-options.php	(revision 8)
    +++ wp-content/plugins/appbanners/tpl/admin-options.php	(revision 9)
    @@ -174,6 +174,15 @@
     					</label>
     				</td>
     			</tr>
    +
    +			<tr>
    +				<td>
    +					<label for="APP_BANNERS_appStoreLanguage">
    +						<p>Do print a viewport meta tag</p>
    +						<p><input type="checkbox" name="APP_BANNERS_printViewPort"<?php if(!empty($printViewPort)){ echo ' checked="checked"'; } ?> /></p>
    +					</label>
    +				</td>
    +			</tr>
     			</tbody>
     		</table>
    
    \ No newline at end of file
    Index: wp-content/plugins/appbanners/appBanners.php
    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
    ===================================================================
    --- wp-content/plugins/appbanners/appBanners.php	(revision 8)
    +++ wp-content/plugins/appbanners/appBanners.php	(revision 9)
    @@ -69,6 +69,7 @@
     		$inAppStore       = htmlspecialchars(get_option( 'APP_BANNERS_inAppStore' ), ENT_QUOTES );
     		$inGooglePlay     = htmlspecialchars(get_option( 'APP_BANNERS_inGooglePlay' ), ENT_QUOTES );
     		$appStoreLanguage = get_option( 'APP_BANNERS_appStoreLanguage' );
    +		$printViewPort    = get_option( 'APP_BANNERS_printViewPort' );
    
     		$options = array(
     			'title' => $title,
    @@ -94,6 +95,7 @@
     			'layer' => false,
     			'iOSUniversalApp' => true,
     			'appendToSelector' => 'body',
    +			'printViewPort' => $printViewPort
     		);
    
     		return $options;
    @@ -111,6 +113,7 @@
     		$author                   = get_option( 'APP_BANNERS_author' );
     		$msApplicationID          = get_option( 'APP_BANNERS_ms_application_id' );
     		$msApplicationPackageName = get_option( 'APP_BANNERS_ms_application_package_name' );
    +		$printViewPort            = get_option( 'APP_BANNERS_printViewPort' );
    
     		if ( $appleID ) {
     			echo '<meta name="apple-itunes-app" content="app-id=' . $appleID . '">' . PHP_EOL;
    @@ -127,8 +130,9 @@
     		if ( $author ) {
     			echo '<meta name="author" content="' . $author . '">' . PHP_EOL;
     		}
    +		if ( $printViewPort ) {
    -		echo '<meta name="viewport" content="width=device-width, initial-scale=1.0">' . PHP_EOL;
    +			echo '<meta name="viewport" content="width=device-width, initial-scale=1.0">' . PHP_EOL;
    -
    +		}
     	}
    
    \ No newline at end of file

    https://ww.wp.xz.cn/plugins/appbanners/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Matt Pramschufer

    (@mattpramschufer)

    Robert,
    Awesome! Thanks for the patch! I just ran through, and everything looks good. I will release into new version. Only thing I changed was to use WordPress checked() function

    <input type="checkbox" name="APP_BANNERS_printViewPort" value='1' <?php checked( $printViewPort, 1); ?> />

    instead of

    <input type="checkbox" name="APP_BANNERS_printViewPort"<?php if(!empty($printViewPort)){ echo ' checked="checked"'; } ?> />

    Plugin Author Matt Pramschufer

    (@mattpramschufer)

    New version pushed.

    = 1.5.10 =
    * Added in checkbox to allow control over outputting META VIEWPORT tag on site.
    * Big shout out to e2.robert for taking the time to submitting the patch!

    Thanks again.

    Thread Starter Robert

    (@e2robert)

    Your response time is amazing. Did not know about checked. Thanks for incorporating the change.

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

The topic ‘Please add option for avoiding …’ is closed to new replies.