Skip to content

Instantly share code, notes, and snippets.

View addButtonToGenesisArchive.php
<?php
/**
* Add Read More button below post excerpts/content on archives.
*/
function jma_child_read_more()
{
// only if this is not a singular page.
if (!is_singular()) {
printf('<a href="%s" class="more-link button">%s</a>', get_permalink(), esc_html__('Continue Reading'));
}
@johnnya23
johnnya23 / pattern.php
Created Sep 12, 2021
sample pattern code (
View pattern.php
<?php
function tabor_register_block_patterns() {
if ( class_exists( 'WP_Block_Patterns_Registry' ) ) {
// $content >>>>> COPY AND PAST FROM LIVE SITE
$content = '<!-- wp:heading {\"align\":\"center\"} -->\n<h2 class=\"has-text-align-center\"><strong>Our approach reflects the people we serve. We are diverse, yet the same.</strong></h2>\n<!-- /wp:heading -->\n\n<!-- wp:buttons {\"align\":\"center\"} -->\n<div class=\"wp-block-buttons aligncenter\"><!-- wp:button {\"borderRadius\":7,\"style\":{\"color\":{\"gradient\":\"linear-gradient(135deg,rgb(0,0,0) 0%,rgb(0,0,0) 50%,rgb(0,0,0) 100%)\"}}} -->\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-background\" style=\"border-radius:7px;background:linear-gradient(135deg,rgb(0,0,0) 0%,rgb(0,0,0) 50%,rgb(0,0,0) 100%)\">Learn More</a></div>\n<!-- /wp:button --></div>\n<!-- /wp:buttons -->\n\n<!-- wp:spacer {\"height\":59} -->\n<div style=\"height:59px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>\n<!-- /wp:spacer -->\n\n<!
View sticky-header-transition.css
.jma-sticky-menu .nav > li > a {
transition: all 1s;
}
.jma-sticky-menu.jma-fixed .nav > li > a {
padding-top: 11px !important;
padding-bottom: 11px !important;
}
View modify_rss_with_youtube_curl.php
<?php
function jma_yt_kid_curl($url)
{
$curl = curl_init($url);
//curl_setopt($curl, CURLOPT_SSLVERSION,3);//forMAMP
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
curl_close($curl);
View add_megamenu_styles_to_admin.php
<?php
function JMA_child_admin_enqueue_css_js()
{
$upload = wp_upload_dir();
$upload_dir = $upload['baseurl'];
wp_enqueue_style('childmegamenu', $upload_dir . '/maxmegamenu/style.css');
$output = 'a.mega-menu-link {pointer-events:none!important}';
wp_add_inline_style('childmegamenu', $output);
}
add_action('admin_enqueue_scripts', 'JMA_child_admin_enqueue_css_js');
@johnnya23
johnnya23 / custom.css
Last active Jan 5, 2022
Create custom display for archives
View custom.css
body.archive .post, body.blog .post {
margin: 0;
padding: 1px;
border: none;
}
body.archive .post img, body.blog .post img {
width: 100%;
}
@johnnya23
johnnya23 / jma_child_single_post_link_grid_filter.php
Last active Jan 5, 2022
uagb grid with Images, title overlays and custom links
View jma_child_single_post_link_grid_filter.php
function jma_child_single_post_link_grid($link, $id)
{
if (function_exists('get_field') && get_field('image_link', $id)) {
$link = get_field('image_link', $id);
}
return $link;
}
add_filter("uagb_single_post_link_grid", 'jma_child_single_post_link_grid', 10, 2);
function jma_child_post_alter_attributes($atts, $id)
@johnnya23
johnnya23 / header-cap.css
Last active Jan 5, 2022
HTML and CSS for Header Cap w/ ph# & email
View header-cap.css
@media (min-width: 768px) {
.add-to-panel .wp-block-column {
flex-basis: 35% !important;
}
.add-to-panel .wp-block-column:first-child {
flex-basis: 150px !important;
}
.add-to-panel .wp-block-column:last-child {
View jma_child_gutentor_button_css_array.php
<?php
function jma_child_getwid_gutentor_button_css_array($css, $mods)
{
$append = array(
array(
'selector' => 'body .jma-btn-default .gutentor-button, body .jma-btn-default .gutentor-pagination-wrap .gutentor-pagination .gutentor-pagination-item .gutentor-pagination-link, body .jma-btn-default .gutentor-navigation .gutentor-next-prev li a, .pagination .page-numbers',
'color' => $mods['button_font'],
'border-style' => 'solid',
'border-color' => $mods['button_font'],
'padding' => $mods['button_vert_padding'] . 'px ' . $mods['button_hor_padding'] . 'px',
@johnnya23
johnnya23 / scrolling-local-menu.js
Last active Jan 5, 2022
Scrolling Local Menu in navbar
View scrolling-local-menu.js
jQuery(document).ready(function($) {
var win_split = window.location.href.split('#');
function gotoid(id) {
$('html,body').animate({
scrollTop: $("#" + id).offset().top - 150
}, 500);
}