Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home office

herbert herbie4

🏠
Working from home office
View GitHub Profile
@herbie4
herbie4 / wp_rss_add_thumbnail_to_rss_feed_for_active_campaign.php
Last active Dec 10, 2020
WordPress: Add Featured Image to RSS feed, works with Active campaign feeds
View wp_rss_add_thumbnail_to_rss_feed_for_active_campaign.php
<?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 / mainwp-add-the-client-reports-link-to-sites-menu.php
Created Dec 4, 2020
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.
View mainwp-add-the-client-reports-link-to-sites-menu.php
@herbie4
herbie4 / yoast-wp-seo-change-og-url.php
Last active Jun 23, 2020
Yoast WP SEO - change the og:url to the current post url when using canonical url
View yoast-wp-seo-change-og-url.php
<?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 / enfold-prev-next-same-category.php
Created Apr 3, 2020
Enfold theme: keep next/prev links in same category
View enfold-prev-next-same-category.php
<?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 / enfold-remove-admin-post-list-editor-state.php
Created Mar 18, 2020
Enfold theme: removes editor status from post/page list in wp-admin
View enfold-remove-admin-post-list-editor-state.php
<?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 / wp-add-noindex-to-older-posts.php
Last active Mar 18, 2020
WordPress: Set metatag to no index for older posts
View wp-add-noindex-to-older-posts.php
<?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