Skip to content

Instantly share code, notes, and snippets.

View herbie4's full-sized avatar
🏠
Working from office

herbert herbie4

🏠
Working from office
View GitHub Profile
@herbie4
herbie4 / wp-add-noindex-to-older-posts.php
Last active March 18, 2020 13:09
WordPress: Set metatag to no index for older posts
<?php
// WordPress: set no index for older posts in WordPress
// -----------------------------
// check the post age
// returns true if older than...
function hhdev_is_old_post($days = 730) {
// 2 years old = 730
@herbie4
herbie4 / enfold-remove-admin-post-list-editor-state.php
Created March 18, 2020 13:07
Enfold theme: removes editor status from post/page list in wp-admin
<?php
// ENFOLD remove wp-admin editor listing from post/page lists
add_filter('display_post_states','hhdev_remove_post_state',999,2);
function hhdev_remove_post_state( $post_states, $post ) {
if("! has_blocks( $post->ID )") {
unset($post_states['wp_editor']);
}
if("!= Avia_Builder()->get_alb_builder_status($post->ID)") {
@herbie4
herbie4 / enfold-prev-next-same-category.php
Created April 3, 2020 07:07
Enfold theme: keep next/prev links in same category
<?php
// return only posts in same category for previous / next links
add_filter('avia_post_nav_settings', 'hhdev_avia_post_nav_settings_mod');
function hhdev_avia_post_nav_settings_mod($settings)
{
$settings['same_category'] = true;
return $settings;
}
@herbie4
herbie4 / yoast-wp-seo-change-og-url.php
Last active June 23, 2020 08:20
Yoast WP SEO - change the og:url to the current post url when using canonical url
<?php
// yoast wp seo plugin og:url override
// ---------------------------
// change the og:url to the current post url when using canonical url
// fix for share on instagram and Facebook to use the website url
// not the canonical url
// ---------------------------
add_filter( 'wpseo_opengraph_url', 'hhdev_change_opengraph_url' );
@herbie4
herbie4 / mainwp-add-the-client-reports-link-to-sites-menu.php
Created December 4, 2020 13:55
MainWP client report menu link in site view. If you use a single report and send it by hand after an update it is easy to get there fast. You do still have to select the correct website to send to.
@herbie4
herbie4 / wp_rss_add_thumbnail_to_rss_feed_for_active_campaign.php
Last active December 10, 2020 15:30
WordPress: Add Featured Image to RSS feed, works with Active campaign feeds
<?php
/**
* WordPress
* Add Featured Image to RSS feed
* works with Active campaign feeds
**/
// haha.nl - herbert hoekstra - 20201210
function hahadev_rss_add_thumbnail() {
global $post;
@herbie4
herbie4 / hhdev-avada-faq-search-list-toggle.html
Created August 12, 2022 09:28
Avada FAQ keyword search list toggle
<div id="form">
<form action="#" class="search">
<input type="text" placeholder="typ een zoekwoord" class="filterinput" />
<small><a href="#" id="filter_reset">Maak zoekveld leeg</a></small>
</form>
</div>
<script>
jQuery("#filter_reset").click(function($){
@herbie4
herbie4 / hhdev-avada-get-url-param-opens-modal.js
Created August 12, 2022 09:31
hhdev Avada get url parameter to open modal
function getParameter(p)
{
var url = window.location.search.substring(1);
var varUrl = url.split('&');
for (var i = 0; i < varUrl.length; i++)
{
var parameter = varUrl[i].split('=');
if (parameter[0] == p)
{
return parameter[1];
@herbie4
herbie4 / wp-gutenberg-deactivate-individual-block-styles.php
Created September 7, 2022 07:41
gutenberg deactivate individual block styles
/*
first enqueue a javascript file
place it in the childtheme dir
*/
function hhdev_enqueue_assets() {
wp_enqueue_script(
'hhdev-remove-block-styles',
get_stylesheet_directory_uri().'/remove-block-styles.js',
array( 'wp-blocks', 'wp-dom-ready', 'wp-edit-post' ),
@herbie4
herbie4 / hhdev-enfold-portfolio-grid-url-param-to-cat.js
Created September 22, 2022 08:15
Enfold theme: using a url param to show the selected portfolio grid category. Use ?psort=[categoryname] to trigger.
/* Enfold theme: using a url param to show the selected portfolio grid category */
jQuery(window).on('load', function ($) {
jQuery.QueryString = (function(a) {
if (a == "") return {};
var b = {};
for (var i = 0; i < a.length; ++i)
{
var p=a[i].split('=');