Skip to content

Instantly share code, notes, and snippets.

View schalkjoubert's full-sized avatar

Schalk Joubert schalkjoubert

  • South Africa
  • 19:50 (UTC +02:00)
View GitHub Profile
@schalkjoubert
schalkjoubert / Storefront Post Meta - Posted On
Created September 28, 2016 14:12
Move the Storefront Posted On date inside the Post Meta
if ( ! function_exists( 'storefront_post_meta' ) ) {
/**
* Display the post meta
*
* @since 1.0.0
*/
<?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 / Use ACF field to populate Title AND update slug
Last active October 6, 2017 04:36
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 ) ) {
@schalkjoubert
schalkjoubert / custom-post-type-description
Last active October 6, 2017 04:38
Custom Post Type Archive Description Field
//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',
<?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 ) )
@schalkjoubert
schalkjoubert / acf-export-2018-02-05.json
Last active February 5, 2018 08:23
ACF Fields to move to Sub Field of Repeater Field
[
{
"key": "group_5a7741d53f5b5",
"title": "Sales Catalogue",
"fields": [
{
"key": "field_5a77425967079",
"label": "Sale Catalogue Entry",
"name": "sale_catalogue_entry",
"type": "repeater",
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 / content-auction.php
Created February 7, 2018 18:44
Testing for elevation from Google Map
<?php
/**
* Template used to display post content.
*
* @package storefront
*/
?>
<!-- https://www.bootply.com/L47vGoEops -->
@schalkjoubert
schalkjoubert / archive-product.php
Created January 25, 2018 14:14
FacetWP in Woocommerce Archive
<?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