Skip to content

Instantly share code, notes, and snippets.

@andrejarh
andrejarh / widget.php
Last active September 20, 2016 16:59
array(
'title' => array(
'type' => 'text',
'label' => __('Widget Title', 'dentalia'),
),
'widget_repeater' => array(
'type' => 'repeater',
'label' => __( 'Add Document' , 'dentalia' ),
'item_name' => __( 'Click to add a document', 'dentalia' ),
'item_label' => array(
<?php
global $wp_filter;
echo '<pre>';
var_dump( $wp_filter['woocommerce_single_product_summary'] );
echo '</pre>';
?>
@andrejarh
andrejarh / gist:3a2936b8f82e7c33a92d8bb4d469645c
Created October 12, 2016 10:16
Wordpress query parameters
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(
@andrejarh
andrejarh / Modify post type (WordPress)
Created January 26, 2017 17:09
Modify post type (WordPress)
add_action( 'init', 'update_team_post_type', 99 );
function update_team_post_type() {
global $wp_post_types;
if ( post_type_exists( 'team-member' ) ) {
// exclude from search results
$wp_post_types['team-member']->exclude_from_search = true;
}
}
@andrejarh
andrejarh / functions.php
Created March 6, 2017 20:17
Custom font in Dentalia Theme
/**
* Add Custom font font to the theme options font list.
*
* @param array $custom_fonts Current custom fonts.
* @return string[string][string] The Web fonts section.
*/
function orion_custom_fonts( $custom_fonts ) {
return array(
'Web Fonts' => array(
'Custom Font' => 'customfont'
@andrejarh
andrejarh / SiteOrigin widget bg Opacy
Created March 30, 2017 10:44
Widget background opacity
/* set the field */
if(!function_exists('orion_bg_opacity_field')) {
function orion_bg_opacity_field($fields) {
$fields['bg_opacity'] = array(
'name' => esc_html__('Background opacity', 'recycle'),
'type' => 'text',
'group' => 'design',
'description' => esc_html__('Must be a number between 1 and 100. 1 is almost transparent, 100 is opaque.', 'recycle'),
'default' => 100,
@andrejarh
andrejarh / orion-static-block-w.php
Created April 10, 2017 10:36
Issue with static blocks and page builder
<?php
/*
Widget Name: (OrionThemes) Static Block
Description: Add Static block content
Author: OrionThemes
Author URI: http://orionthemes.com
*/
if(!function_exists('orion_get_static_blocks')) {
function orion_get_static_blocks() {
function orion_static_block_shortcode_func( $atts, $content = '' ) {
if (!isset($atts['block']) || $atts['block'] == "") {
return;
} else {
$block_id = $atts['block'];
return siteorigin_panels_render($block_id);
}
}
add_shortcode( 'staticblock', 'orion_static_block_shortcode_func' );
@andrejarh
andrejarh / functions.php
Created August 2, 2017 22:11
Include template through plugin (WP)
add_filter('template_include', 'my_function_name');
function my_function_name( $template ) {
if( is_post_type_archive( 'post-type-name' ) ){
$template = dirname( __FILE__ ) . '/archive-posttype.php';
}
if( is_single( 'post-type-name' )) {
$template = dirname( __FILE__ ) . '/single-posttype.php';
}
return $template;
}
@andrejarh
andrejarh / gist:0967ef2f7a89d05aba7ce1c529ffce20
Created May 22, 2018 20:40
Make team member widget unclickable
.widget_orion_team_w a {
pointer-events: none!important;
display: block;
}