Add URL parameter to all internal links using a specific theme

You can set the $_GET global internally. By saving the parameter passed as user meta and/or a cookie and retrieving it later. This would probably have to be put in your /wp-content/mu-plugins/ folder to work properly (so it is loaded early): <?php $parameter=”theme”; // default for theme test drive $savemethod = ‘both’; // ‘usermeta’ (only), … Read more

Conditional featured image with youtube thumbnail

There are three problems 1. echo and php tags within an echo Change your first echo from: echo ‘<img src=”http://img.youtube.com/vi/<?php echo get_post_meta($post->ID,’video_url’,true);?>/0.jpg”/>’; to this: echo ‘<img src=”http://img.youtube.com/vi/’ . get_post_meta($post->ID,’video_url’,true) . ‘/0.jpg”/>’; 2. if statement not wrapped and no brackets change: if get_post_meta($post->ID,’video_url’,true) to: if (get_post_meta($post->ID,’video_url’,true)) and add {} around that code block: if (get_post_meta($post->ID,’video_url’,true)) { … Read more

Get css class of menu item in custom menu structure

What you’re getting is an array so you need to implode() them – the Walker_Nav_Menu has something like this: $class_names = esc_attr( implode( ‘ ‘, apply_filters( ‘nav_menu_css_class’, array_filter( $classes ), $item ) ) ); So you can modify your foreach to implode them in a similar fashion $class = esc_attr( implode( ‘ ‘, apply_filters( ‘nav_menu_css_class’, … Read more

Trying To Get Child Categories To Show, Issue With foreach Loop

Do the categories all have posts, change line 2 to: $categories = wp_list_categories(‘hide_empty=0&title_li=0&child_of=”.$categoryslug->term_id”); This sets it to display all categories even if empty If that doesn’t work then you need to echo each part and find the cause of the “error” so echo each element e.g. echo $categoryslug; if that works then change to echo … Read more

Dividing the loop to style post differently

You don’t need to alter the code for different formatting, you can simply use the :first-child pseudoclass in css. The foreach loop will, presumably, generate similar blocks of code, structured like this: <div class=”all-my-posts”> <article class=”my-slider-post”> … </article> <article ..> </article> … </div> Now you can simply addres the first <article> block with css like … Read more

Output custom text field as unordered list

This is more about string and array manipulation with php than a WordPress related question. The proper way to do it would be using a repeater field instead of a single text input. Advanced Custom Fields, which seems to be the plugin you are using, has a nice repeater addon. That would let the users … Read more

Convert canvas to image and upload image to server

Since the file you send is base64 encoded, you will need to decode and save the result into a file at a temp directory. From there it is just a normal server side wordpress image manipulation and insertion of the relevant info into the DB, something that there are many examples for on this site. … Read more