Skip to content

Instantly share code, notes, and snippets.

<?php
add_action( 'pre_get_posts', 'buddyforms_filter_cpt_listing_by_author' );
function buddyforms_filter_cpt_listing_by_author( $wp_query_obj ) {
// First let us check if this is a page. We not want to restrict pages
if( !isset( $wp_query_obj->query ) || isset( $wp_query_obj->query['page'] ) || 'page' == $wp_query_obj->query['post_type'] ){
return $wp_query_obj;
}
// Check if the user is logged in and display a page to logged off users
@svenl77
svenl77 / buddyforms_gmw_update_location.php
Last active July 27, 2017 11:18
BuddyForm GEO my WP Location Update after Save or Update a Post
<?php
// Update the geo location after save or update the post with buddyforms
add_action('buddyforms_after_save_post', 'my_buddyforms_gmw_update_location', 10, 1 );
function my_buddyforms_gmw_update_location( $post_id ) {
//make sure we have post ID
if ( !$post_id )
return;
//change meta_field_name to the BuddyForms Form Lelement SLUG of the address field
{
"name": "WWSC-WP-Connect",
"slug": "wwsc-wp-connect",
"version": "1.1.13",
"download_url": "http://buddyforms/wwsc-wp-connect.zip",
"homepage": "https://wwsc.de/",
"requires": "4.0",
"tested": "4.8",
"last_updated": "2017-01-01 16:17:00",
"upgrade_notice": "Here's why you should upgrade...",
@svenl77
svenl77 / buddyforms_user_posts_query_args_posts_per_page.php
Created July 20, 2017 11:28
buddyforms_user_posts_query_args_posts_per_page
<?php
add_filter('buddyforms_user_posts_query_args_posts_per_page', 'my_buddyforms_user_posts_query_args_posts_per_page', 10, 1 );
function my_buddyforms_user_posts_query_args_posts_per_page( $posts_per_page ){
return 3;
}
@svenl77
svenl77 / buddyforms_support_siteorigin.php
Last active May 17, 2017 09:37
BuddyForms Support for Site Origin Page Builder
<?php
add_filter('buddyforms_wp_editor', 'buddyforms_support_siteorigin', 10, 2);
function buddyforms_support_siteorigin($wp_editor, $post_id){
// First let us make sure the siteorigin_panels_render function exists
// Check if the editor content is created by siteorigin and overwrite the variable $wp_editor with a noice.
if (function_exists('siteorigin_panels_render') && siteorigin_panels_render( $post_id )){
// Change this notice to your needs.
$wp_editor = 'This Post is Created with Site Origin Page Builder and can not get changed in the Frontend. How ever, you can still change all other form elements ;)';
@svenl77
svenl77 / buddyforms_wp_insert_post_args.php
Last active May 16, 2017 11:32
buddyforms_wp_insert_post_args
<?php
add_filter( 'buddyforms_wp_insert_post_args', 'my_buddyforms_wp_insert_post_args', 10, 2);
function my_buddyforms_wp_insert_post_args( $args, $forms_slug ){
if( $forms_slug == 'FORM SLUG' ){
$args['page_template'] = 'template-name.php';
}
return $args;
@svenl77
svenl77 / buddyforms_loop_template_name.php
Created April 24, 2017 06:53
Register new Loop Templates
<?php
add_filter( 'buddyforms_loop_template_name', 'my_buddyforms_loop_template_name' );
function my_buddyforms_loop_template_name($templates){
$templates['new-template'] = 'New Template';
return $templates;
}
jQuery(document).ready(function () {
var $instance = jQuery('.buddyforms-pin').easypin({
init: '{"91":{"0":{"coords":{"lat":"303","long":"215.5"}},"canvas":{"src":"img/2011-12-18-23.51.12.jpg","width":"auto","height":"auto"}}}',
limit: 1,
exceeded: function(element) {
alert('You only able to create one pin at the time ;)');
},
responsive: true,
@svenl77
svenl77 / buddyboss-onesocial.php
Last active January 3, 2017 09:01
Deregister BuddyBoss selectboxes-script in the OneSocial theme. Its not compatible with Select2 version 4
<?php
add_action( 'wp_enqueue_scripts', 'buddyboss_deregister_scripts', 10, 1 );
function buddyboss_deregister_scripts(){
wp_deregister_script( 'selectboxes-script' );
}
@svenl77
svenl77 / select-form.html
Created November 21, 2016 16:57
BuddyForms Select Form Example
<select onchange="location = this.options[this.selectedIndex].value;">
<option>Please select the form you like to use</option>
<option value="DOMAIN/PAGE/create/FORM1/">Form 1</option>
<option value="DOMAIN/PAGE/create/FORM2/">Form 2</option>
<option value="DOMAIN/PAGE/create/FORM3/">Form 3</option>
</select>​