Skip to content

Instantly share code, notes, and snippets.

View gicolek's full-sized avatar

Rafał Gicgier - Certified Codeable Expert Developer gicolek

View GitHub Profile
@gicolek
gicolek / bbpress.php
Created May 27, 2016 11:56
Add bbPress Topic belonging from a specific Forum to ACF Recent Posts Widget only.
<?php
add_filter( 'acf_rwp_query', 'wp_doin_add_bbpress_forum_topics' );
function wp_doin_add_bbpress_forum_topics($query) {
$query['post_type'] = 'topic';
// this is the id of the specific forum
$query['post_parent'] = 126;
return $query;
}
@gicolek
gicolek / uoe.php
Last active September 2, 2017 16:16
Username or Email login
<?php
//Заставляем работать форму авторизации GF
/*
* This hook fires after the form was submitted and the whole data was validate, we’ll bind it to the form which have just created.
*/
// the _14 prefix has to match the id of the form you have created
add_action( "gform_after_submission_14", "login_form_after_submission", 10, 2 );
function login_form_after_submission($entry, $form) {
@gicolek
gicolek / reload.js
Created October 27, 2015 14:20
Dynamic WooCommerce attributes reload
/**
* Handler for Widget Filters
* **********************************************************************************
*/
var obj = {};
var obj_ajax = {};
var out = '';
// on each widget input click
$('.widget_attributes input').click(function (e) {
@gicolek
gicolek / img.html
Created September 4, 2015 14:56
BLah
<p>
<a href="http://r3summit.dev/wp-content/uploads/2015/09/pic_article-big.jpg">
<img src="http://r3summit.dev/wp-content/uploads/2015/09/pic_article-big.jpg" alt="pic_article-big" width="328" height="246" class="alignleft size-full wp-image-96">
</a>
</p>
@gicolek
gicolek / media_buttons.php
Created August 26, 2015 13:30
Custom Media Buttons Button
<?php
add_action( 'admin_footer', 'wp_doin_mce_popup' );
add_action( 'media_buttons', 'wp_doin_media_buttons' );
/**
* Utility to add MCE Popup fired by custom Media Buttons button
*
* @hook admin_footer
*/
@gicolek
gicolek / div_shortcode.php
Created August 26, 2015 12:59
Sample shortcode
<?php
add_shortcode( 'div', 'wp_doin_div_shortcode' );
function wp_doin_div_shortcode($atts, $content = null) {
ob_start();
// let's fetch all of the arguments of the shortcode
$atts = shortcode_atts( array(
'class' => 'wp-doin',
'heading' => 'Heading',
'subheading' => 'Subheading',
@gicolek
gicolek / acf_rwp_query.php
Created July 22, 2015 13:08
ACF Recent Posts Query Filter
<?php
add_filter( 'acf_rwp_query', 'wp_doin_custom_query' );
/**
* @hook acf_rwp_query
*/
function wp_doin_custom_query($query) {
// say we want to limit the query to only single author
$query['author'] = 1;
return $query;
@gicolek
gicolek / acp_rwp_before.php
Created July 22, 2015 13:05
ACF Recent Posts Widget before hook
<?php
remove_filter( 'acp_rwp_before', array( 'ACF_Helper', 'af_bf_content_filter' ) );
add_filter( 'acp_rwp_before', 'wp_doin_before_custom_text', 999, 3 );
/**
* @hook acp_rwp_before
*/
function wp_doin_before_custom_text($before, $instance, $id) {
@gicolek
gicolek / gf_dynamic.js
Created June 3, 2015 21:50
Gravity Forms dynamic reload
<script type="text/javascript">
// let's make call to the global gwrf variable visible after enabling Gravity Forms
window.gwrf;
(function ($) {
gwrf = function (args) {
// prototype arguments, created when we instantiate it
this.formId = args.formId;
this.spinnerUrl = args.spinnerUrl;
@gicolek
gicolek / gf_rp_sf.php
Created May 15, 2015 11:18
Gravity Forms Password Recovery Second Form
<?php
// remember, the hook suffix, should contain the form id!
add_filter( 'gform_field_validation_1', 'wp_doin_validation_1', 10, 4 );
/**
* Custom GF validation function used for pagination and required fields
*
* @return string
*/