heading and cta styles

This commit is contained in:
2025-01-23 12:07:51 -08:00
parent b0eb83530c
commit 095651c4bf
2 changed files with 71 additions and 43 deletions

View File

@@ -2382,7 +2382,7 @@
"name": "copy",
"aria-label": "",
"type": "wysiwyg",
"instructions": "To add button style for a link add class=\"button--primary\" to anchor tag.",
"instructions": "To add button style for a link add class=\"button--primary\" to anchor tag.\r\nOr, after creating the link, highlight it and choose from the Formats section.\r\nTo add different heading styles add class=\"h1\" class=\"h2\" etc...",
"required": 0,
"conditional_logic": 0,
"wrapper": {
@@ -2391,6 +2391,7 @@
"id": ""
},
"default_value": "",
"allow_in_bindings": 1,
"tabs": "all",
"toolbar": "full",
"media_upload": 1,
@@ -8574,5 +8575,5 @@
"active": true,
"description": "",
"show_in_rest": 0,
"modified": 1736974944
"modified": 1737662796
}

View File

@@ -217,7 +217,8 @@ function populate_SESSpromotion_description($value) {
* @author Golden Oak Web Design <info@goldenoakwebdesign.com>
* @license https://www.gnu.org/licenses/gpl-2.0.html GPLv2+
*/
function blog_generate_rewrite_rules( $wp_rewrite ) {
function blog_generate_rewrite_rules($wp_rewrite)
{
$new_rules = array(
'(([^/]+/)*blog)/page/?([0-9]{1,})/?$' => 'index.php?pagename=$matches[1]&paged=$matches[3]',
'blog/([^/]+)/?$' => 'index.php?post_type=post&name=$matches[1]',
@@ -245,57 +246,83 @@ function blog_generate_rewrite_rules( $wp_rewrite ) {
'blog/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$' => 'index.php?post_type=post&attachment=$matches[1]&cpage=$matches[2]',
);
$wp_rewrite->rules = $new_rules + $wp_rewrite->rules;
}
}
add_action( 'generate_rewrite_rules', 'blog_generate_rewrite_rules' );
add_action('generate_rewrite_rules', 'blog_generate_rewrite_rules');
function update_post_link( $post_link, $id = 0 ) {
$post = get_post( $id );
if( is_object( $post ) && $post->post_type == 'post' ) {
return home_url( '/blog/' . $post->post_name . '/');
function update_post_link($post_link, $id = 0)
{
$post = get_post($id);
if (is_object($post) && $post->post_type == 'post') {
return home_url('/blog/' . $post->post_name . '/');
}
return $post_link;
}
add_filter( 'post_link', 'update_post_link', 1, 3 );
}
function skip_redirect( $skip_redirect, $post_id, $post ) {
if ( $post->post_type === 'post' ) {
$skip_redirect = true;
}
add_filter('post_link', 'update_post_link', 1, 3);
return $skip_redirect;
}
function skip_redirect($skip_redirect, $post_id, $post)
{
if ($post->post_type === 'post') {
$skip_redirect = true;
}
return $skip_redirect;
}
add_filter( 'wpseo_premium_post_redirect_slug_change', 'skip_redirect', 10, 3 );
add_filter('wpseo_premium_post_redirect_slug_change', 'skip_redirect', 10, 3);
// Google Tag Manager
add_action( 'wp_head', 'gtm_output', 2 );
add_action( 'wp_footer', 'gtm_datalayer_init', 10 );
add_action( 'body_top', 'gtm_noscript_output' );
add_action('wp_head', 'gtm_output', 2);
add_action('wp_footer', 'gtm_datalayer_init', 10);
add_action('body_top', 'gtm_noscript_output');
function gtm_output() { ?>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-MJH5WQQ');</script>
<!-- End Google Tag Manager -->
<?php
function gtm_output()
{
?><!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-MJH5WQQ');</script>
<!-- End Google Tag Manager --><?php
}
function gtm_noscript_output() { ?>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MJH5WQQ"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<?php
function gtm_noscript_output()
{
?><!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MJH5WQQ"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) --><?php
}
function gtm_datalayer_init() {?>
<script>window.dataLayer = window.dataLayer || [];</script>
<?php
function gtm_datalayer_init()
{
?><script>window.dataLayer = window.dataLayer || [];</script><?php
}
add_filter('mce_buttons', function ($buttons) {
return array_merge(['styleselect'], $buttons);
});
// Attach callback to 'tiny_mce_before_init'
add_filter('tiny_mce_before_init', function ($init_array) {
$init_array['style_formats'] = wp_json_encode([
[
'title' => 'CTA Primary',
'selector' => 'a',
'classes' => ['button--primary'],
],
[
'title' => 'CTA Secondary',
'selector' => 'a',
'classes' => ['btn', 'btn-secondary'],
],
[
'title' => 'CTA Tertiary',
'selector' => 'a',
'classes' => ['btn', 'btn-outline-primary'],
],
]);
// die(var_dump($init_array));
return $init_array;
});