Skip to content

Instantly share code, notes, and snippets.

View volodymyrpekh's full-sized avatar

Vlad Pekh volodymyrpekh

View GitHub Profile
@volodymyrpekh
volodymyrpekh / filter.php
Created January 4, 2017 21:42 — forked from kingkool68/filter.php
Using `wp_debug_backtrace_summary()` to only filter something when called from a particular function or method
/*
Here we're filtering the site_url() and get_site_url() functions which are called dozens and dozens of times during a request.
In this case we only want to modify $url if the filter was called from a particular PHP class (rtCamp\WP\Nginx\Helper)
*/
add_filter( 'site_url', function( $url = '' ) {
$backtrace = wp_debug_backtrace_summary();
if ( stripos( $backtrace, 'rtCamp\WP\Nginx\Helper' ) ) {
$url = str_replace( 'https://', 'http://', $url );
}
return $url;
@volodymyrpekh
volodymyrpekh / footer.php
Created January 11, 2017 05:23 — forked from rali14/footer.php
Display footer on listings archive pages (listify)
@volodymyrpekh
volodymyrpekh / functions.php
Created January 11, 2017 05:28 — forked from rali14/functions.php
Add Information into listings footer on the listing grid on Listify theme.
function add_information_to_listing_footer() {
global $post;
echo '<h2>hello!</h2>';
}
add_action( 'listify_content_job_listing_footer', 'add_information_to_listing_footer', 25 );
@volodymyrpekh
volodymyrpekh / functions.php
Created January 11, 2017 05:31 — forked from rali14/functions.php
Display the username instead of first name on Account menu item
function custom_menu_item_name () {
$current_user = wp_get_current_user();
return $current_user->user_login;
}
add_filter( 'listify_acount_menu_user_label', custom_menu_item_name, 99 );
@volodymyrpekh
volodymyrpekh / archive-job_listings.php
Created January 11, 2017 05:33 — forked from rali14/archive-job_listings.php
Display term descriptions on the listing archive pages. (Listify)
<?php
/**
* Customized version of the template for displaying Job Listings which includes the term descriptions
*
* Also used for all job listing taxonomy archives.
*
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package Listify
*/
@volodymyrpekh
volodymyrpekh / functions.php
Created January 11, 2017 05:38 — forked from rali14/functions.php
Set default cover image for all listings
function custom_default_listify_cover_image( $image, $args ) {
global $post;
if ( $post->post_type == 'job_listing' ) {
return ""; //You can add URL to a default image here or leave it blank if you do not want a background for listings
}
}
add_filter( 'listify_cover_image', 'custom_default_listify_cover_image', 10, 2 );
@volodymyrpekh
volodymyrpekh / footer.php
Created January 11, 2017 05:49 — forked from rali14/footer.php
Hide CTA for logged in users
@volodymyrpekh
volodymyrpekh / footer.php
Created January 11, 2017 05:51 — forked from rali14/footer.php
Enable footer on the Job Listings Archive (Listify)
@volodymyrpekh
volodymyrpekh / content-aso.php
Created January 11, 2017 05:29 — forked from rali14/content-aso.php
Enable Shortcodes on As Seen On Section Listify
<?php
/**
* The template for displaying the call to action
*/
$title = listify_theme_mod( 'as-seen-on-title' );
$logos = listify_theme_mod( 'as-seen-on-logos' );
if ( '' == $logos ) {
return;
}
?>
<?php
// filter the Gravity Forms button type
add_filter("gform_submit_button_1", "form_submit_button", 10, 2);
function form_submit_button($button, $form){
return "<button class='button' id='gform_submit_button_{$form["id"]}'><span><i class='fa fa-share fa-2x'></i> Send </span></button>";
}
//Change hook of gform_submit_button_X to the form that you are using
//Change <span><i class='fa fa-share fa-2x'></i> Send </span> to Font awesome and text of your choice