Skip to content

Commit

Permalink
#28: Add support for Lore theme
Browse files Browse the repository at this point in the history
  • Loading branch information
nielslange committed May 29, 2020
1 parent 52aec86 commit 7802c7b
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ You can find the plugin on https://wordpress.org/plugins/smntcs-custom-logo-link
## Changelog

### 1.11 (2020.05.29)
* [Add support for Lore theme](https://github.com/nielslange/smntcs-custom-logo-link/issues/28)
* [Add support for Suffice theme](https://github.com/nielslange/smntcs-custom-logo-link/issues/27)

### 1.10 (2020.04.29)
Expand Down
1 change: 1 addition & 0 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Contributions are more than welcome. Simply head over to [Github](https://github
== Changelog ==

= 1.11 (2020.05.29) =
* [Add support for Lore theme](https://github.com/nielslange/smntcs-custom-logo-link/issues/28)
* [Add support for Suffice theme](https://github.com/nielslange/smntcs-custom-logo-link/issues/27)

= 1.10 (2020.04.29) =
Expand Down
19 changes: 19 additions & 0 deletions cypress/integration/lore.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
describe.skip('Lore', () => {

before(function () {
cy.login();
});

it('can ensure the Lore theme is activated', () => {
cy.checkThemeActivation('lore');
});

it('can ensure the site title shows the custom link', () => {
cy.checkSiteTitleLink('a.header-title__link');
});

it('can ensure the site logo shows the custom link', () => {
cy.checkSiteLogoLink('a.header-logo__image');
});

});
2 changes: 1 addition & 1 deletion cypress/integration/suffice.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe.only('Suffice', () => {
describe('Suffice', () => {

before(function () {
cy.login();
Expand Down
4 changes: 4 additions & 0 deletions smntcs-custom-logo-link.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ function smntcs_custom_logo_link_enqueue() {
// phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
include_once 'themes/hestia.php';
break;
case 'lore':
// phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
include_once 'themes/lore.php';
break;
case 'neve':
// phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
include_once 'themes/neve.php';
Expand Down
53 changes: 53 additions & 0 deletions themes/lore.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php
/**
* Handle custom logo link for Lore theme
*
* Neve: https://themeforest.net/item/lore-elegant-knowledge-base-wordpress-theme/16965024
* @category Plugin
* @package WordPress
* @subpackage SMNTCS Custom Logo Link
* @author Niels Lange <info@nielslange.de>, Derek Smith <derek@timbre-design.com>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/

if ( get_option( 'smntcs_custom_logo_link_url' ) ) { ?>
<script>
document.addEventListener("DOMContentLoaded", function() {
if ( document.querySelector("a.header-title__link") ) {
document.querySelector("a.header-title__link").setAttribute("href", "<?php print( esc_url( get_option( 'smntcs_custom_logo_link_url' ) ) ); ?>");
}
if ( document.querySelector("a.header-logo__image") ) {
document.querySelector("a.header-logo__image").setAttribute("href", "<?php print( esc_url( get_option( 'smntcs_custom_logo_link_url' ) ) ); ?>");
}
});
</script>
<?php
if ( get_option( 'smntcs_custom_logo_link_target' ) ) {
?>
<script>
document.addEventListener("DOMContentLoaded", function() {
if ( document.querySelector("a.header-title__link") ) {
document.querySelector("a.header-title__link").setAttribute("target", "_blank");
}
if (document.querySelector("a.header-logo__image")) {
document.querySelector("a.header-logo__image").setAttribute("target", "_blank");
}
});
</script>
<?php
} else {
?>
<script>
document.addEventListener("DOMContentLoaded", function() {
if ( document.querySelector("a.header-title__link") ) {
document.querySelector("a.header-title__link").setAttribute("target", "_self");
}
if (document.querySelector("a.header-logo__image")) {
document.querySelector("a.header-logo__image").setAttribute("target", "_self");
}
});
</script>
<?php
}
}

0 comments on commit 7802c7b

Please sign in to comment.