Skip to content

Instantly share code, notes, and snippets.

View catlauraherzog's full-sized avatar

Laura catlauraherzog

  • Concepts & Training
  • Solingen / Germany
View GitHub Profile
<?php
function update_webprofile_field( $form_id ) {
global $ninja_forms_processing;
if( $ninja_forms_processing->get_extra_value( '_ninja_forms_profile_editor' ) == 1 ){
$user_id = $ninja_forms_processing->get_user_ID();
$all_fields = $ninja_forms_processing->get_all_fields();
foreach( $all_fields as $key => $value ){
$field_row = $ninja_forms_processing->get_field_settings( $key );
$field_data = $field_row['data'];
if( isset( $field_data['profile_meta_value'] ) AND $field_data['profile_meta_value'] != '' && $value !== false ){
@catlauraherzog
catlauraherzog / post_type_args.php
Created November 12, 2014 07:42
post_type_args
<?php
$defaults = array(
'labels' => array(),
'description' => '',
'public' => false,
'hierarchical' => false,
'exclude_from_search' => null,
'publicly_queryable' => null,
'show_ui' => null,
'show_in_menu' => null,
@catlauraherzog
catlauraherzog / register_post_type.php
Created November 12, 2014 07:23
register_post_type
<?php
/**
* Registers our plugin
*
* @wp-hook plugins_loaded
* @return void
*/
function wpc_post_type_example() {
// init our post type registration
@catlauraherzog
catlauraherzog / my_plugin_wp_list_categories.php
Last active August 29, 2015 14:09
my_plugin_wp_list_categories
<?php
/**
* This function manipulates the category list
*
* @wp-hook get_term_list
* @param string $output HTML output
* @param array $args the arguments of this function
* 'show_option_all' (string) - Text to display for showing all categories.
* 'orderby' (string) default is 'ID' - What column to use for ordering the categories.
* 'order' (string) default is 'ASC' - What direction to order categories.
@catlauraherzog
catlauraherzog / wpc_manipulate_the_title.php
Last active August 29, 2015 14:09
wpc_manipulate_the_title with own filter
<?php
/**
* Manipulates the title of a post
*
* @wp-hook the_title
* @param string $title the original title
* @param int $post_id the ID of the current post
* @return string $title the manipulated title
*/
function wpc_manipulate_the_title( $title, $post_id ) {
@catlauraherzog
catlauraherzog / wpc_my_plugin_name_init.php
Last active August 29, 2015 14:09
wpc_my_plugin_name_init with do_action
<?php
/**
* This function loads all plugin files,
* registers the actions and filters which are
* needed to get this plugin on work. It also
* registers the needed language packs and its
* textdomain.
*
* @wp-hook plugins-loaded
* @return void
@catlauraherzog
catlauraherzog / do_action.php
Last active August 29, 2015 14:09
article with do_action
<article>
<main>
<?php do_action( 'wpc_my_theme_single_post_before_content' ); ?>
<?php the_content(); ?>
<?php do_action( 'wpc_my_theme_single_post_after_content' ); ?>
</main>
</article>
@catlauraherzog
catlauraherzog / wpc_manipulate_the_title.php
Last active August 29, 2015 14:09
wpc_manipulate_the_title with arguments
<?php
/**
* Manipulates the title of a post
*
* @wp-hook the_title
* @param string $title the original title
* @param int $post_id the ID of the current post
* @return string $title the manipulated title
*/
function wpc_manipulate_the_title( $title, $post_id ) {
@catlauraherzog
catlauraherzog / wpc_manipulate_the_title.php
Last active August 29, 2015 14:09
wpc_manipulate_the_title
<?php
/**
* Manipulates the title of a post
*
* @wp-hook the_title
* @param string $title the original title
* @return string $title the manipulated title
*/
function wpc_manipulate_the_title( $title ) {
@catlauraherzog
catlauraherzog / filter_the_title_2.php
Last active August 29, 2015 14:09
filter_the_title_2
<?php
/**
* Manipulates the title of a post
*
* @wp-hook the_title
* @param string $title the original title
* @return string $title the manipulated title
*/
function wpc_manipulate_the_title( $title ) {