new0
Neues Wissen einreichen

PHP

WP Query category not in

not in: $args = array( ‚post_type‘ => ‚post‘, ‚posts_per_page‘ => 3, ‚post_status‘ => ‚publish‘, ‚order‘ => ‚DESC‘, ‚order_by‘ => ‚date‘, ‚tax_query‘ => array( array( ‚taxonomy’=>’category‘, ‚field‘ => ’slug‘, ‚terms‘ => ‚events‘, ‚operator‘ => ‚NOT IN‘, ) ) ); category in: $args = array( ‚post_type‘ => ‚post‘, ‚posts_per_page‘ => 3, ‚post_status‘ => ‚publish‘, ‚order‘ => ‚DESC‘, […]

mehr erfahren

Zeige alle enqued Scripts Styles in WordPress

function print_scripts_styles() { $result = []; $result[’scripts‘] = []; $result[’styles‘] = []; global $wp_scripts; foreach( $wp_scripts->queue as $script ) : $result[’scripts‘][] = $wp_scripts->registered[$script]->src . „;“; endforeach; global $wp_styles; foreach( $wp_styles->queue as $style ) : $result[’styles‘][] = $wp_styles->registered[$style]->src . „;“; endforeach; return $result; } add_action( ‚wp_head‘, ‚get_all_scripts‘); function get_all_scripts() { $user = wp_get_current_user(); if( is_user_logged_in() && […]

mehr erfahren

Font-Size in tiny mce , wysiwyg

// Enable font size and font family selects in the editor if ( ! function_exists( ‚am_add_mce_font_buttons‘ ) ) { function am_add_mce_font_buttons( $buttons ) { array_unshift( $buttons, ‚fontsizeselect‘ ); // Add Font Size Select return $buttons; } } add_filter( ‚mce_buttons_2‘, ‚am_add_mce_font_buttons‘ ); // you can use mce_buttons_2 or mce_buttons_3 to change the rows where the buttons […]

mehr erfahren

ACF Feldtypen

Tab: $options_footer_fieldgroup->addField( ‚tab‘, __(‚Infos Spalte 1′, ’steirerhaus‘), ‚tab_col1′ ); Wysiwyg: $options_footer_fieldgroup->addField( ‚wysiwyg‚, ‚Text Spalte 1‚, ‚content_col1‚); Link: $options_footer_fieldgroup->addField( ’number‘, ‚Telefonnummer‘, ‚phone_col3‘ ); Email: $options_footer_fieldgroup->addField( ‚email‘, ‚Email Adresse‘, ‚mail_col3′ ); Number: $options_footer_fieldgroup->addField( ’number‘, ‚Telefonnummer‘, ‚phone_col3‘ );

mehr erfahren

Rename slug of post_type

function bmc_modify_builtin_post_args( $args, $post_type ) { if( $post_type == ‚post‘) { $args[‚rewrite‘] = array( ’slug‘ => ‚blog‘, ‚with_front‘ => true ); } return $args; } add_filter( ‚register_post_type_args‘, ‚bmc_modify_builtin_post_args‘, 10, 2 );

mehr erfahren

Mailchimp Connection

// Mailchimp if($status == ’success‘) { try { $api_key = get_field(‚kp_supplier_api_key‘, ‚option‘); $email = $email; $status = ’subscribed‘; // subscribed, cleaned, pending $list_id = get_field(‚kp_supplier_list_id‘, ‚option‘); $args = array( ‚method‘ => ‚PUT‘, ‚headers‘ => array( ‚Authorization‘ => ‚Basic ‚ . base64_encode( ‚user:‘. $api_key ) ), ‚body‘ => json_encode(array( ‚email_address‘ => $email, ’status‘ => $status, ‚merge_fields‘ […]

mehr erfahren

When vc-element first pos, add Class to body

Wenn ein bestimmtes VC-Element an erster Stelle ausgegeben wird, kann mit dieser Funktion eine Klasse zum Body hinzugefügt werden: /** * Add custom classes to body * * @param $classes array * @return array */ function spl_add_bodyclasses( $classes ) { global $post; // Check if vc_bgimage element is the first in content preg_match_all( ‚/‘. get_shortcode_regex() […]

mehr erfahren

write log in wordpres

if ( ! function_exists(‚write_log‘)) { function write_log ( $log ) { if ( is_array( $log ) || is_object( $log ) ) { error_log( print_r( $log, true ) ); } else { error_log( $log ); } } }

mehr erfahren