Skip to content

Instantly share code, notes, and snippets.

🐞
Debugging

Jon Fuller Garconis

🐞
Debugging
Block or report user

Report or block Garconis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Garconis
Garconis / impreza-theme-options-per-cpt.php
Created Jun 12, 2019
Impreza | Help update theme meta data to certain post types (only run once)
View impreza-theme-options-per-cpt.php
<?php
$local_args = array(
'posts_per_page' => -1,
'post_type' => 'fs_local',
);
$local_posts_array = get_posts( $local_args );
foreach ( $local_posts_array as $post ) {
update_post_meta( $post->ID, 'us_header_id', '__defaults__' );
update_post_meta( $post->ID, 'us_titlebar_id', '__defaults__' );
@Garconis
Garconis / project-go-back-link-based-on-category.php
Created May 28, 2019
WordPress | Create a "Go Back" link based on what category the Project belongs to
View project-go-back-link-based-on-category.php
@Garconis
Garconis / divi-custom-preloader-function.php
Created May 24, 2019
Divi | Custom Preloader PHP function
View divi-custom-preloader-function.php
<?php
add_action('wp_footer', 'fs_preloader_code');
function fs_preloader_code(){
if(is_front_page()) { ?>
<div class="fs-preloader">
<div class="fs-status"></div>
</div>
<?php }
};
add_action('wp_head', 'fs_preloader_js');
@Garconis
Garconis / acf-repeater-field-shortcode.php
Created May 17, 2019
WordPress | ACF Repeater Field output with shortcode
View acf-repeater-field-shortcode.php
<?php
// ACF Group Shortcode
function shortcode_acf_find_my_flowers( $atts ) {
// begin output buffering
ob_start();
if( have_rows('where_to_find_my_flowers') ) {
@Garconis
Garconis / tag-cloud-based-on-category-via-shortcode.php
Created May 6, 2019
WordPress | Tag cloud for categories via shortcode
View tag-cloud-based-on-category-via-shortcode.php
<?php
function tag_cloud_shortcode($atts) {
// first make sure we are within a category
if (is_category()) {
// get info of current category
$category = get_category( get_query_var( 'cat' ) );
// get current category ID
@Garconis
Garconis / wp-all-export-post-date-time-format.php
Last active Apr 25, 2019
WP All Export | Ensure post dates are pulled from actual time and not GMT date
View wp-all-export-post-date-time-format.php
<?php
/** In WP All Export, add a new ID field and give it a custom Column Name, then...
* set the field to "Export the value returned by a PHP function"...
* where the function name is fs_format_get_date ...
* then add this function to the Function Editor, so that...
* the column in the export will use the proper date timezone and post time, rather than the "post_date_gmt" value
*/
function fs_format_get_date ($id) {
$new_date = get_the_date($d = 'Y-m-d H:i:s', $id);
return $new_date;
@Garconis
Garconis / translate-string-with-function.php
Last active Mar 22, 2019
WordPress | Translate string with PHP function
View translate-string-with-function.php
<?php
// option 1, to change text site wide
add_filter( 'gettext', 'fs_translate_strings_1', 20, 3 );
function fs_translate_strings_1( $translation, $text, $domain ) {
// STRING 1
$translation = str_ireplace( 'My Old Text', 'My New Text', $translation );
// STRING 2
$translation = str_ireplace( 'Old Text', 'New text', $translation );
return $translation;
@Garconis
Garconis / wp-config.php
Created Mar 8, 2019
WordPress | debug PHP by enabling WP_DEBUG log file in WP Config
View wp-config.php
<?php // remove this line
// add this to your wp-config.php file, before /* That's all, stop editing! Happy blogging. */
define( 'WP_DEBUG', true );
if (WP_DEBUG) {
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors',0);
}
@Garconis
Garconis / tml-change-lost-password-page-if-on-certain-url.php
Created Mar 4, 2019
Theme My Login | Shortcodes to spit out a custom Logout anchor and Helpers to force-change the Lost Password URL for certain pages/forms.
View tml-change-lost-password-page-if-on-certain-url.php
<?php
/* shortcode that will output the Logout URL with Kiosk URL redirect, as anchor and text */
// [fs_kiosk_logout_url_anchor class="whatever-it-is you-want"]Log Out[/fs_kiosk_logout_url_anchor]
add_shortcode( 'fs_kiosk_logout_url_anchor', 'fs_sc_kiosk_logout_url_anchor' );
function fs_sc_kiosk_logout_url_anchor( $atts, $content = null ) {
// define attributes and their defaults
$a = shortcode_atts( array(
'class' => 'kiosk-logout-url-anchor'
), $atts );
@Garconis
Garconis / progress-maps-trigger-search-form-and-wrap-links.js
Last active Dec 7, 2018
Progress Maps | Trigger the search form box if a button is clicked, and also wrap URLs with a link
View progress-maps-trigger-search-form-and-wrap-links.js
You can’t perform that action at this time.