Skip to content

Instantly share code, notes, and snippets.

@tdmrhn
tdmrhn / rss_force_featured_image.php
Created June 13, 2021 10:58
RSS Force Featured Image
@tdmrhn
tdmrhn / blocksy-add-selected-posts.php
Created June 14, 2021 14:36
Blocksy add selected posts to Blog Archive
add_action('blocksy:hero:after', 'blocksy_featured_posts', 10);
function blocksy_featured_posts(){
if ( is_home() ) {
echo do_shortcode ("[blocksy_posts post_ids=10,25,48 limit=3 has_pagination=no]");
}
}
@tdmrhn
tdmrhn / lightweight-accordion-by-andy.css
Created June 19, 2021 16:55
Lightweight Accordion Hover and Open State title color change
.lightweight-accordion details summary:hover {
background:var(--paletteColor3) !important;
color:var(--paletteColor8) !important;
}
.lightweight-accordion details[open] summary {
background:var(--paletteColor1) !important;
color:var(--paletteColor8) !important;
}
@tdmrhn
tdmrhn / delete-wordpress-wp-admin.php
Created June 26, 2021 17:29
Deleting "- Wordpress" page title
<?php
add_filter( 'login_title', 'blc_wp_new_title' );
add_filter( 'admin_title', 'blc_wp_new_title', 10, 2);
function blc_wp_new_title( $login_title ) {
return str_replace(array( ' &lsaquo;', ' &#8212; WordPress'), array( ' &lsaquo;', ''),$login_title );
}
@tdmrhn
tdmrhn / blocksy-blog-archive-simple-two-columns.css
Created June 30, 2021 07:35
Blocksy Blog Archive Simple Type 2 Columns
@media (min-width: 1000px) {
.entries[data-layout="simple"] {
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-column-gap: var(--grid-columns-gap, 30px);
}
}
@tdmrhn
tdmrhn / gutenberg-responsive-embed-support.php
Created July 1, 2021 15:59
Gutenberg Responsive Embed Support
<?php
add_action( 'after_setup_theme', function() {
add_theme_support( 'responsive-embeds' );
} );
@tdmrhn
tdmrhn / any-href-div-tabs.js
Created July 8, 2021 13:33
Simple jQuery Tabs Code Built for GB
jQuery(document).ready(function($) {
$(".tabcontents .content").hide();
$(".tabs a:first").addClass("active").show();
$(".tabcontents .content").hide().filter(":first").show();
$(".tabs a").click(function() {
$(".tabs > a").removeClass("active");
$(this).addClass("active");
$(".tabcontents .content").hide();
var activeTab = $(this).attr("href");
$(activeTab).show();
@tdmrhn
tdmrhn / custom_recaptcha.php
Last active July 16, 2021 09:14
Custom Recaptcha v1
<?php
add_action('login_enqueue_scripts', 'login_recaptcha_script');
function login_recaptcha_script() {
wp_register_script('recaptcha_login', 'https://www.google.com/recaptcha/api.js?render=reCAPTCHA_site_key');
wp_enqueue_script('recaptcha_login');
}
add_action( 'login_form', 'display_recaptcha_on_login' );
function display_recaptcha_on_login() {
echo "<script> function onSubmit(token) { document.getElementById('loginform').submit(); } </script> <button class='g-recaptcha' data-sitekey='YOUR_PUBLIC_KEY' data-callback='onSubmit' data-size='invisible' style='display:none;'>Submit</button>";
@tdmrhn
tdmrhn / add_description_to_product_card.php
Last active July 17, 2021 16:10
Add Description to Product Card
<?php
add_action('woocommerce_after_shop_loop_item_title', 'add_description_to_product_card', 3 );
function add_description_to_product_card() {
global $product;
$limit = 10;
$description = $product->get_description();
if (str_word_count($description, 0) > $limit) {
$words = str_word_count($description, 2);
$pos = array_keys($words);
$excerpt = substr($description, 0, $pos[$limit]) . '...';
@tdmrhn
tdmrhn / marge_decription_reviews_tabs.php
Created July 19, 2021 21:37
Marge Description & Review Tabs
<?php
add_filter( 'woocommerce_product_tabs', 'blc_marge_decription_reviews_tabs', 99 );
function blc_marge_decription_reviews_tabs( $tabs ) {
unset( $tabs['reviews'] );
$tabs['description']['callback'] = function() {
global $post, $product;
the_content();
echo '<h2>Reviews</h2>';
comments_template();
};