Add extra markup to WP menus

When developing a menu on a bootstrap based theme, I now use the following Walker: ‘walker’ => new Custom_Walker_Nav_Menu class Custom_Walker_Nav_Menu extends Walker_Nav_Menu { // add classes to ul sub-menus function start_lvl( &$output, $depth ) { // depth dependent classes $indent = ( $depth > 0 ? str_repeat( “\t”, $depth ) : ” ); // … Read more

Create Customization Controls from Array

Please add “;” after $i = $i++ and see if that fixes your issue foreach ($socialIcons as $icon) { $i = $i++; $wp_customize->add_setting( ‘pxk_href_’ . $icon[‘name’], // use this in twig file call to theme_mod array( ‘default’ => ”, ‘transport’ => ‘postMessage’, ‘priority’ => $i ) );

Archive page if else not working for post_excerpt and post_content

Apart from the horribly format issues you also have a typo: <?php $my_excerpt = $item->post_excerpt; if ($my_excerpt){ echo Str::limit($my_excerpt, 120);} else $content = ($item->post_content);{ $contentexcerpt = substr($content, 0, 150); echo $contentexcerpt, ‘…’; } ?> These lines: else $content = ($item->post_content);{ should be: else { $content = ($item->post_content); The parser registered a single line of code … Read more

blank page when trying to change upload directory

You need a better function, your paths are broken – see this answer for reference: function wpse_16722_type_upload_dir( $args ) { if ( ! empty( $_REQUEST[‘post_id’] ) && $post_id = absint( $_REQUEST[‘post_id’] ) ) { if ( $post = get_post( $post_id ) ) { if ( $post->post_type !== ‘attachment’ ) { $args[‘subdir’] = “/$post->post_type”; // Must … Read more

If else statement based on referral URL

a $_GET variable would be the better option. try var_dump($_GET); on the page before the conditional and see exactly what you need to test against It seems that there is something more to the puzzle that we are missing. Is the file not showing up correctly? Could that be because the file paths are wrong? … Read more