Different registration form for different roles

I don’t know how “Cimy User Extra Fields” works, but you can add fields to the user registration page with: function extra_user_profile_fields_wpse_92164() { echo ‘<label for=”extra_field”>’,_(“Extra Field”).'</label>’; echo ‘<input type=”text” name=”extra_field” value=”” size=”25″ id=”extra_field” />’; } add_action( ‘register_form’, ‘extra_user_profile_fields_wpse_92164’ ); To switch subscriber types you could pass in $_GET parameters, which is how the default … Read more

linked php file not executing php

The problem is not that the PHP doesn’t execute. It does execute but you get fatal errors because you are loading your template files directly, which means they are loading without the WordPress framework that supplies necessary functions. View source of those pages and you can see error. You should not be linking directly to … Read more

the_post_thumbnail issues

the_post_thumbnail() prints the HTML immediately. Use get_the_post_thumbnail() instead to get the HTML into your string. $content .= ‘<div class=”thumbnail”>’ . get_the_post_thumbnail( null, “home-post-thumbnail”) . ‘</div>’;

Display multi-select box choices in a bullet list [closed]

From your comment below: This code displays the members selections but only as a comma separated list: <?php bp_member_profile_data( ‘field=Countries’ ); ?> // $countries_csl should contain something like ‘hufflepuff, hogwarts, heaven, hell’ $contries_csl = bp_get_member_profile_data( ‘field=Countries’ ); // convert the comma seperated list (csl) into an array by using explode( [delimiter], [string] ) $countries = … Read more

WordPress truncate posts question (plugin related)

This is a rather sloppily coded plugin, unfortunately. However, to answer your questions: Replace the function gopiplus_clean with this function gopiplus_clean( $excerpt, $length = 0 ) { $string = strip_tags( str_replace( ‘[…]’, ‘…’, $excerpt ) ); if ( $length > 0 ) { $words_array = preg_split( “/[\n\r\t ]+/”, $excerpt, $length + 1, PREG_SPLIT_NO_EMPTY ); $words … Read more

Defining multiple categories for showing latest posts

This is incorrect formatting of a PHP array: ‘cat’ => ‘4’, ‘5’, ‘6’, ‘7’ Use category__in and pass an array of category IDs: $args = array( ‘posts_per_page’ => 4, ‘category__in’ => array( 4, 5, 6, 7 ) ); See WP_Query for all valid parameters and how to format them correctly.

Woocommerce getting top level category parent and make all sub categories have the same template and menu

WP native function get_queried_object() can help you to get an ID of a currently displayed term. WooCommerce then includes this handy function: woocommerce_get_term_top_most_parent() (originated here on WPSE btw,) that will get it’s top-level parent term. I haven’t tested the following code but it should provide a good starting point: if ( ‘wedgwood’ == woocommerce_get_term_top_most_parent( get_queried_object()->term_id … Read more