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

Add subscribe button to global and sticky nav #71

Merged
merged 1 commit into from
Mar 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions wp-content/themes/mstoday/css/child.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion wp-content/themes/mstoday/css/child.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion wp-content/themes/mstoday/css/child.min.css

Large diffs are not rendered by default.

28 changes: 27 additions & 1 deletion wp-content/themes/mstoday/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,4 +324,30 @@ function mstoday_get_page_template() {
add_filter( 'page_template', 'get_post_template' );
}
}
add_filter( 'init', 'mstoday_get_page_template' );
add_filter( 'init', 'mstoday_get_page_template' );

/**
* Display a subscribe button in the navbars
*
* @param str $location The location that this button is placed
*
* @return str The formatted subscribe button
*/
function mstoday_subscribe_button( $location = null ) {

if( 'sticky' === $location ) {

printf( '<a class="subscribe-link" href="%1$s"><span>%2$s</span></a>',
esc_url( '\/subscribe\/' ),
esc_html( 'Subscribe' )
);

} else {

printf( '<div class="subscribe-btn"><a href="%1$s">%2$s</a></div>',
esc_url( '\/subscribe\/' ),
esc_html( 'Subscribe' )
);

}
}
37 changes: 37 additions & 0 deletions wp-content/themes/mstoday/less/_nav.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
.subscribe-btn {
float: left;
margin: 5px 0 0 10px;
background: @pink;
font-size: 14px;
line-height: 2;
a {
padding: 24px 7px;
color: #fff;
&:hover {
text-decoration: none;
color: @white;
}
}
&:hover {
background: darken(@pink, 5%);
}
}
.subscribe {
.subscribe-link {
span {
padding: 4px 8px;
color: #fff;
background-color: @pink;
font-size: 16px;
&:hover {
background-color: darken(@pink, 5%);
}
}
&:hover {
background: transparent;
}
}
&:hover {
background: transparent;
}
}
4 changes: 3 additions & 1 deletion wp-content/themes/mstoday/less/_vars.less
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@
@lightgray: #5b6670;

@pink: #b92454;
@orange: #ff6c37;
@orange: #ff6c37;

@white: #fff;
1 change: 1 addition & 0 deletions wp-content/themes/mstoday/less/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@import "_forms.less";
@import "_ads.less";
@import "_interstitials.less";
@import "_nav.less";

/* Typography */
body {
Expand Down
70 changes: 70 additions & 0 deletions wp-content/themes/mstoday/partials/nav-global.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php
/*
* Global Navigation Menu
*
* Shown at the very top of a Largo site on a (default) thin dark bar.
* Not shown when sticky navigation is displayed, so typically only the home page.
* This menu is appended to the offcanvas nav menu (see partial/nav-sticky.php).
*
* @package Largo
* @link http://largo.readthedocs.io/users/menus.html#available-menu-areas
*/

if (
! is_single() && ! is_singular()
|| ! of_get_option( 'main_nav_hide_article', false )
|| is_front_page()
) {
?>
<div class="global-nav-bg">
<div class="global-nav">
<nav id="top-nav" class="span12">
<span class="visuallyhidden">
<a href="#main" title="<?php esc_attr_e( 'Skip to content', 'largo' ); ?>"><?php _e( 'Skip to content', 'largo' ); ?></a>
</span>
<?php
/* Global Navigation Menu Query */
$top_args = array(
'theme_location' => 'global-nav',
'depth' => 1,
'container' => false,
);
largo_nav_menu($top_args);
?>
<div class="nav-right">
<?php
/* Check to display Social Media Icons */
if ( of_get_option( 'show_header_social') ) { ?>
<ul id="header-social" class="social-icons visible-desktop">
<?php largo_social_links(); ?>
</ul>
<?php }
/*
* Display Subscribe button
*/
if( function_exists( 'mstoday_subscribe_button' ) ) {
mstoday_subscribe_button();
}
/* Check to display Donate Button */
if ( of_get_option( 'show_donate_button') ) {
largo_donate_button();
}

if ( ! is_search() ) {
?>
<div id="header-search">
<form class="form-search" role="search" method="get" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<div class="input-append">
<input type="text" placeholder="<?php _e('Search', 'largo'); ?>" class="input-medium appendedInputButton search-query" value="" name="s" /><button type="submit" class="search-submit btn"><?php _e('GO', 'largo'); ?></button>
</div>
</form>
</div>
<?php
}
?>
<!-- END Header Search -->
</div>
</nav>
</div> <!-- /.global-nav -->
</div> <!-- /.global-nav-bg -->
<?php }
Loading