Skip to content

Instantly share code, notes, and snippets.

schalkjoubert

Block or report user

Report or block schalkjoubert

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
@schalkjoubert
schalkjoubert / content-auction.php
Created Feb 7, 2018
Testing for elevation from Google Map
View content-auction.php
<?php
/**
* Template used to display post content.
*
* @package storefront
*/
?>
<!-- https://www.bootply.com/L47vGoEops -->
View opensslerror.txt
Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /app/public/wp-content/themes/storechild-master/content-single-auction.php on line 175 Warning: file_get_contents(): Failed to enable crypto in /app/public/wp-content/themes/storechild-master/content-single-auction.php on line 175 Warning: file_get_contents(https://maps.googleapis.com/maps/api/elevation/xml?locations=40.7143528,-74.0059731&key=AIzaSyCM1fCTYKPhk6tDCqsVNhcXto6aqjUc0yY): failed to open stream: operation failed in /app/public/wp-content/themes/storechild-master/content-single-auction.php on line 175 Fatal error: Uncaught Exception: String could not be parsed as XML in /app/public/wp-content/themes/storechild-master/content-single-auction.php:176 Stack trace: #0 /app/public/wp-content/themes/storechild-master/content-single-auction.php(176): SimpleXMLElement->__construct('') #1 /app/public/wp-includes/template.php(690): require
@schalkjoubert
schalkjoubert / acf-export-2018-02-05.json
Last active Feb 5, 2018
ACF Fields to move to Sub Field of Repeater Field
View acf-export-2018-02-05.json
[
{
"key": "group_5a7741d53f5b5",
"title": "Sales Catalogue",
"fields": [
{
"key": "field_5a77425967079",
"label": "Sale Catalogue Entry",
"name": "sale_catalogue_entry",
"type": "repeater",
@schalkjoubert
schalkjoubert / archive-product.php
Created Jan 25, 2018
FacetWP in Woocommerce Archive
View archive-product.php
<?php
/**
* The Template for displaying product archives, including the main shop page which is a post type archive
*
* This template can be overridden by copying it to yourtheme/woocommerce/archive-product.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
View change-post-type-upload-path
<?php
if(!empty( $_REQUEST["post_id"]) ) {
add_filter('upload_dir', 'tsum_upload_dir');
$upload = wp_upload_dir();
// remove_filter('upload_dir', 'tsum_upload_dir');
function tsum_upload_dir( $upload ) {
$id = $_REQUEST['post_id'];
$parent = get_post( $id )->post_parent;
// Check the post-type of the current post
if( "post-type-name-ie-product" == get_post_type( $id ) || "post-type-name-ie-product" == get_post_type( $parent ) )
View Top Level Plugin
<?php
/**
* Plugin Name: Home Page CPT
**/
add_action( 'admin_menu', 'my_admin_menu' );
function my_admin_menu() {
add_menu_page( 'My Top Level Menu Example', 'Top Level Menu', 'manage_options', 'example.php', 'myplguin_admin_page', 'dashicons-tickets', 6 );
}
@schalkjoubert
schalkjoubert / Storefront Post Meta - Posted On
Created Sep 28, 2016
Move the Storefront Posted On date inside the Post Meta
View Storefront Post Meta - Posted On
if ( ! function_exists( 'storefront_post_meta' ) ) {
/**
* Display the post meta
*
* @since 1.0.0
*/
@schalkjoubert
schalkjoubert / custom-post-type-description
Last active Oct 6, 2017
Custom Post Type Archive Description Field
View custom-post-type-description
//http://wpsettingsapi.jeroensormani.com/
add_action( 'admin_menu', 'tsumtour_add_admin_menu' );
add_action( 'admin_init', 'tsumtour_settings_init' );
function tsumtour_add_admin_menu( ) {
add_submenu_page( 'edit.php?post_type=tour', 'Tour', 'Intro', 'manage_options', 'tour', 'tsumtour_options_page' );
}
function tsumtour_settings_init( ) {
register_setting( 'pluginPage', 'tsumtour_settings' );
add_settings_section(
'tsumtour_pluginPage_section',
@schalkjoubert
schalkjoubert / Use ACF field to populate Title AND update slug
Last active Oct 6, 2017
Use ACF field to populate Title AND update slug
View Use ACF field to populate Title AND update slug
//Auto add and update Title field:
function my_post_title_updater( $post_id ) {
$my_post = array();
$my_post['ID'] = $post_id;
$my_post['post_name'] = '';
$posttypes = array( 'accommodation', 'destination' );
$currentposttype = get_post_type($post_id);
if ( in_array( $currentposttype, $posttypes ) ) {
You can’t perform that action at this time.