Skip to content

Commit

Permalink
Merge pull request #1136 from INN/1135-SHOW_STICKY_NAV-deprecation
Browse files Browse the repository at this point in the history
Deprecate the constant SHOW_STICKY_NAV
  • Loading branch information
aschweigert committed Apr 6, 2016
2 parents bf08e6c + 5b6199d commit ecb501f
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
4 changes: 3 additions & 1 deletion docs/developers/constants.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ The other constants

.. php:const:: SHOW_STICKY_NAV
The sticky nav appears on the homepage and all internal pages, and on mobile devices, governed by ``SHOW_STICKY_NAV``. ``SHOW_STICKY_NAV`` my be defined to be true or false, but the easiest way to set it is to check "Show the Sticky Nav" in the Theme Options section of Largo.
**DEPRECATED** in Largo version 0.5.5. Conditional logic based on this constant should remove the conditional logic, and make sure that the HTML stucture is similar to that of `partials/nav_sticky.php <https://github.com/INN/Largo/blob/master/partials/nav-sticky.php>`_. The element ``#sticky-nav-holder`` will be shown or hidden by `navigation.js <https://github.com/INN/Largo/blob/master/js/navigation.js>`_.

The sticky nav used to appear on the homepage and all internal pages, and on mobile devices, governed by ``SHOW_STICKY_NAV``. ``SHOW_STICKY_NAV`` may be defined to be true or false.

.. php:const:: SHOW_MAIN_NAV
Expand Down
11 changes: 6 additions & 5 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,13 @@ private function template_constants() {
if ( ! defined( 'SHOW_GLOBAL_NAV' ) ) {
define( 'SHOW_GLOBAL_NAV', TRUE );
}
/*
* SHOW_STICKY_NAV is deprecated.
* @link https://github.com/INN/Largo/issues/1135
* @since 0.5.5
*/
if ( ! defined( 'SHOW_STICKY_NAV' ) ) {
if ( of_get_option( 'show_sticky_nav' ) ) {
define( 'SHOW_STICKY_NAV', TRUE );
} else {
define( 'SHOW_STICKY_NAV', FALSE );
}
define( 'SHOW_STICKY_NAV', FALSE );
}
if ( ! defined( 'SHOW_MAIN_NAV' ) ) {
define( 'SHOW_MAIN_NAV', TRUE );
Expand Down
17 changes: 10 additions & 7 deletions inc/header-footer.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
<?php

/**
* Check for active Sticky Nav
* DEPRECATED: Check the constant SHOW_STICKY_NAV.
*
* Checks both the option and the constant to see if the sticky nav is currently showing.
* Whether or not the sticky nav is displayed is determined by the javascript in js/navigation.js, since Largo 0.5.4.
*
* @since 0.5.2
* @return Bool
* @deprecated the constant SHOW_STICKY_NAV is deprecated
* @link https://github.com/INN/Largo/issues/1135
* @since 0.5.5
*/
function largo_sticky_nav_active() {
if ( SHOW_STICKY_NAV == true && of_get_option( 'show_sticky_nav' ) ) {
return true;
}
return false;
if ( SHOW_STICKY_NAV ) {
return true;
}
return false;
}

/**
Expand Down
5 changes: 0 additions & 5 deletions inc/update.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,6 @@ function largo_update_prominence_term_description_single($update, $term_descript
function largo_force_settings_update() {
$options = array();
// paste in default settings from options.php after this line;
$options[] = array(
'desc' => __('Show the <strong>sticky nav</strong>? Default is to show, but in some cases you may want to hide it.'),
'id' => 'show_sticky_nav',
'std' => '1',
'type' => 'checkbox');
$options[] = array(
'desc' => __('Starting with version 0.4, Largo introduced a new single-post template that more prominently highlights article content, which is the default. For backward compatibility, the pre-0.3 version is also available.', 'largo'),
'id' => 'single_template',
Expand Down
1 change: 0 additions & 1 deletion tests/inc/test-update.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@ function test_largo_update_prominence_term_descriptions() {
function test_largo_force_settings_update() {
of_reset_options();
largo_force_settings_update();
$this->assertEquals('1', of_get_option('show_sticky_nav'));
$this->assertEquals('normal', of_get_option('single_template'));
}

Expand Down

0 comments on commit ecb501f

Please sign in to comment.