Skip to content

Instantly share code, notes, and snippets.

@runezero
runezero / custom_code_for_wp_head.php
Created June 13, 2022 13:54
[Page header featured image] Add the featured image as banner to the page with the title and breadcrumb in the image #enfold
add_action('wp_head', 'custom_code_for_wp_head');
function custom_code_for_wp_head(){
global $post;
$post_type = get_post_type($post->ID);
// Only for pages with featured image added and not for single posts also excluding woocommerce pages
if( has_post_thumbnail($post->ID) && $post_type != 'product' && $post_type != 'post' ) { ?>
<style type="text/css">
.inner-header-bg, .title_container {
background-image: url("<?php echo the_post_thumbnail_url( 'full' ); ?>");
}
@runezero
runezero / ava_before_footer.php
Created June 13, 2022 13:53
[Add pre-footer] Add a block before the footer for repeating content #enfold
@runezero
runezero / avf_google_heading_font.php
Created June 13, 2022 13:51
[Add google fonts] Add Google fonts to the theme support #enfold
<?php
add_filter( 'avf_google_heading_font', 'avia_add_heading_font');
function avia_add_heading_font($fonts) {
$fonts['PT Sans Narrow'] = 'PT Sans Narrow:400,700';
$fonts['PT Sans'] = 'PT Sans:400,700,400italic,700italic';
return $fonts;
}
add_filter( 'avf_google_content_font', 'avia_add_content_font');
function avia_add_content_font($fonts) {
@runezero
runezero / kriesi_backlink.php
Created June 13, 2022 13:50
[Disable footer backlinks] Remove the Kriesi link in footer links #enfold
@runezero
runezero / after_setup_theme.php
Created June 13, 2022 13:49
[Disable Portfolio cpt] Disable the portfolio custom post type within Enfold #enfold
<?php
add_action( 'after_setup_theme','remove_portfolio_post_type', 100 );
function remove_portfolio_post_type() {
remove_action( 'init', 'portfolio_register');
}
@runezero
runezero / wp_get_referer.php
Created June 7, 2022 11:57
[Get referrer url] Get the referrer url and previous page id from the current page parameters #wordpress
<?php
//get the referrer url
wp_get_referer()
//get the post_id from the referrer url
url_to_postid(wp_get_referer());
@runezero
runezero / image-house-shape.scss
Last active June 3, 2022 13:58
[Image SVG clip-path] Render an image from a specific path from a SVG file
//https://codepen.io/designcourse/pen/qBqdoYe
.image-house-shape{
.avia-image-overlay-wrap{
&::before{ //red shadow
position: absolute;
display: block;
content: " ";
width: 100%;
@runezero
runezero / change_avia_date_format.php
Created June 1, 2022 13:29
[Change date format display] Change the publish date formatting in Enfold #enfold
add_filter('avia_widget_time', 'change_avia_date_format', 10, 2);
function change_avia_date_format($date, $function) {
return explode('-', $date)[0];
}
@runezero
runezero / pmxi_after_xml_import.php
Created June 1, 2022 09:00
[WP All Import trigger next import] After an import has finished, trigger the next import by id with a trigger url #wordpress
//https://www.wpallimport.com/documentation/code-snippets/#trigger-the-next-import-on-completion-of-an-import
function after_xml_import($import_id, $import)
{
// Only run for import ID 5.
if ($import_id == 5) {
// Call the next import's trigger URL.
wp_remote_get("yourtriggerURLhere");
@runezero
runezero / woocommerce_after_single_product_summary.php
Last active May 25, 2022 19:25
[Remove related products] Remove the related products on the single product page #woocommerce
/**
* Remove related products output
*/
add_action('woocommerce_after_single_product_summary', 'remove_related_products', 10);
function remove_related_products() {
if ( is_product() ){
remove_action( 'woocommerce_after_single_product_summary', 'avia_woocommerce_output_related_products', 20);
}
}