Last active
August 29, 2015 13:57
-
-
Save q2amarket/9680759 to your computer and use it in GitHub Desktop.
The hook will replace custom page name as body class instead of 'custom'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* hook: page name as a body class | |
* | |
* hook by: Q2A Market | |
* author: Jatin Soni | |
* url: http://www.q2amarket.com | |
* version: 1.00 | |
* | |
* Description: | |
* The hook will add custom page name | |
* as body class instead of 'custom' | |
* | |
* usage: | |
* Place below code into your theme or plugin layer | |
* | |
* function body_tags(){} | |
* | |
* There are two versions for this hook | |
* | |
* First: | |
* You can replace 'qa-template-custom' with | |
* the page name `qa-template-my-page | |
* | |
* Second: | |
* This will add aditinal class to the body tag | |
* <body class="qa-template-custom my-page"> | |
* | |
* Disclaimer: | |
* This program is distributed in the hope that | |
* it will be useful, but WITHOUT ANY WARRANTY; | |
* without even the implied warranty of MERCHANTABILITY | |
* or FITNESS FOR A PARTICULAR PURPOSE. | |
* | |
* See the GNU General Public License for more details. | |
*/ | |
// To add aditional class for the custom page | |
// <body class="qa-template-custom my-page"> | |
function body_tags() | |
{ | |
$class = 'qa-template-' . qa_html($this->template); | |
if($this->template == 'custom') | |
$class.=' ' . qa_request(); | |
if (isset($this->content['categoryids'])) | |
foreach ($this->content['categoryids'] as $categoryid) | |
$class.=' qa-category-' . qa_html($categoryid); | |
$this->output('class="' . $class . ' qa-body-js-off"'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* hook: page name as a body class | |
* | |
* hook by: Q2A Market | |
* author: Jatin Soni | |
* url: http://www.q2amarket.com | |
* version: 1.00 | |
* | |
* Description: | |
* The hook will add custom page name | |
* as body class instead of 'custom' | |
* | |
* usage: | |
* Place below code into your theme or plugin layer | |
* | |
* function body_tags(){} | |
* | |
* There are two versions for this hook | |
* | |
* First: | |
* You can replace 'qa-template-custom' with | |
* the page name `qa-template-my-page | |
* | |
* Second: | |
* This will add aditinal class to the body tag | |
* <body class="qa-template-custom my-page"> | |
* | |
* Disclaimer: | |
* This program is distributed in the hope that | |
* it will be useful, but WITHOUT ANY WARRANTY; | |
* without even the implied warranty of MERCHANTABILITY | |
* or FITNESS FOR A PARTICULAR PURPOSE. | |
* | |
* See the GNU General Public License for more details. | |
*/ | |
// To replace qa-template-custom to qa-template-my-page | |
function body_tags() | |
{ | |
$class = (($this->template == 'custom') ? 'qa-template-' . qa_request() : 'qa-template-' . qa_html($this->template)); | |
if (isset($this->content['categoryids'])) | |
foreach ($this->content['categoryids'] as $categoryid) | |
$class.=' qa-category-' . qa_html($categoryid); | |
$this->output('class="' . $class . ' qa-body-js-off"'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment