Title: willroy's Replies | WordPress.org

---

# willroy

  [  ](https://wordpress.org/support/users/willroy/)

 *   [Profile](https://wordpress.org/support/users/willroy/)
 *   [Topics Started](https://wordpress.org/support/users/willroy/topics/)
 *   [Replies Created](https://wordpress.org/support/users/willroy/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/willroy/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/willroy/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/willroy/engagements/)
 *   [Favorites](https://wordpress.org/support/users/willroy/favorites/)

 Search replies:

## Forum Replies Created

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/users/willroy/replies/page/2/?output_format=md)
[→](https://wordpress.org/support/users/willroy/replies/page/2/?output_format=md)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Simple SEO] google Search Console Error](https://wordpress.org/support/topic/google-search-console-error-2/)
 *  [willroy](https://wordpress.org/support/users/willroy/)
 * (@willroy)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/google-search-console-error-2/#post-9570419)
 * Do you know when this will be released? Not really wanting to but may have to
   look for alternative plugin :/
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Loco Translate] Adding Plural & Single](https://wordpress.org/support/topic/adding-plural-single/)
 *  Thread Starter [willroy](https://wordpress.org/support/users/willroy/)
 * (@willroy)
 * [11 years ago](https://wordpress.org/support/topic/adding-plural-single/#post-6071101)
 * Ok going over the process again, I was skipping saving the master .POT after 
   running the sync with source code.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Events Manager - Calendar, Bookings, Tickets, and more!] Shortcode for duration of event?](https://wordpress.org/support/topic/shortcode-for-duration-of-event/)
 *  Thread Starter [willroy](https://wordpress.org/support/users/willroy/)
 * (@willroy)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/shortcode-for-duration-of-event/#post-5967909)
 * Ok I ended up adding my own filter, here it is if anyone needs or need to add
   their own shortcodes that work in the EM Event scope:
 * `#_EVENTDAYS` returns “x day(s)”
    `#_EVENTSTARTDATE` returns event_start_date
 *     ```
       add_filter('em_event_output','mc_em_event_output',10,4);
   
       function mc_em_event_output($event_string,$obj,$format,$target) {
   
       	//Now let's check out the placeholders.
        	preg_match_all("/(#@?_?[A-Za-z0-9]+)({([^}]+)})?/", $event_string, $placeholders);
        	$replaces = array();
       	foreach($placeholders[1] as $key => $result) {
       		$match = true;
       		$replace = '';
       		$full_result = $placeholders[0][$key];
       		switch( $result ){
       			case '#_EVENTDAYS':
       				// Return number of days
       				if( $obj->event_start_date != $obj->event_end_date){
       					$replace = floor(($obj->end - $obj->start)/(60*60*24)) + 1 . ' days';
       				}else{
       					$replace = 1 . ' day';
       				}
       				break;
       			case '#_EVENTSTARTDATE':
       				// Return event start date
                                      $date_format = ( get_option('dbem_date_format') ) ? get_option('dbem_date_format'):get_option('date_format');
       				if( $obj->event_start_date != $obj->event_end_date){
       					$replace = date_i18n($date_format, $obj->start);
       				}
       				break;
       			default:
       				$replace = $full_result;
       				break;
       		}
       		$replaces[$full_result] = apply_filters('em_event_output_placeholder', $replace, $this, $full_result, $target);
       	}
       	//sort out replacements so that during replacements shorter placeholders don't overwrite longer varieties.
       	krsort($replaces);
       	foreach($replaces as $full_result => $replacement){
       		if( !in_array($full_result, array('#_NOTES','#_EVENTNOTES')) ){
       			$event_string = str_replace($full_result, $replacement , $event_string );
       		}else{
       		    $new_placeholder = str_replace('#_', '__#', $full_result); //this will avoid repeated filters when locations/categories are parsed
       		    $event_string = str_replace($full_result, $new_placeholder , $event_string );
       			$desc_replace[$new_placeholder] = $replacement;
       		}
       	}		
   
       	return $event_string;
   
       }
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Events Manager - Calendar, Bookings, Tickets, and more!] Single Event -> moving post_content above event data?](https://wordpress.org/support/topic/single-event-moving-post_content-above-event-data/)
 *  Thread Starter [willroy](https://wordpress.org/support/users/willroy/)
 * (@willroy)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/single-event-moving-post_content-above-event-data/#post-5930293)
 * Ahhh – #_EVENTNOTES
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Events Manager - Calendar, Bookings, Tickets, and more!] Single Event -> moving post_content above event data?](https://wordpress.org/support/topic/single-event-moving-post_content-above-event-data/)
 *  Thread Starter [willroy](https://wordpress.org/support/users/willroy/)
 * (@willroy)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/single-event-moving-post_content-above-event-data/#post-5930292)
 * in the “Single event page format” area? I can not see a shortcode tag that you
   can use for the post_content of a page?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Events Manager - Calendar, Bookings, Tickets, and more!] [Plugin: Events Manager] Accessing data from template such as Event Date, Time, Location etc..](https://wordpress.org/support/topic/plugin-events-manager-accessing-data-from-template-such-as-event-date-time-location-etc/)
 *  Thread Starter [willroy](https://wordpress.org/support/users/willroy/)
 * (@willroy)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-events-manager-accessing-data-from-template-such-as-event-date-time-location-etc/#post-2989960)
 * Andddd answered my own question again:
 * `<?php echo print_r(EM_Events::get($post->ID)) ?>`
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [custom post type with post_id in permalink structure](https://wordpress.org/support/topic/custom-post-type-permalink-structure/)
 *  [willroy](https://wordpress.org/support/users/willroy/)
 * (@willroy)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/custom-post-type-permalink-structure/#post-1526635)
 * I’ve got as far as displaying the links with the CPT entry name however it’s 
   returning a 404 not found when clicked on:
 * // Create a rewrite rule for the Vacancies CPT so that ID numbers can also be
   used:
 *     ```
       add_action('init', 'vacancies_rewrite');
       function vacancies_rewrite() {
         global $wp_rewrite;
         $queryarg = 'post_type=vacancies&p=';
         $wp_rewrite->add_rewrite_tag('%cpt_id%', '([^/]+)', $queryarg);
         $wp_rewrite->add_permastruct('vacancies', '/vacancies/%cpt_entry%/%cpt_id%', false);
       }
       ```
   
 * // Now hook the post_type_link filter
 *     ```
       add_filter('post_type_link', 'vacancies_permalink', 1, 3);
       function vacancies_permalink($post_link, $id = 0, $leavename) {
         global $wp_rewrite;
         $post = &get_post($id);
         if ( is_wp_error( $post ) )
           return $post;
         $newlink = $wp_rewrite->get_extra_permastruct('vacancies');
         $newlink = str_replace("%cpt_id%", $post->ID, $newlink);
         $newlink = str_replace("%cpt_entry%", $post->post_name, $newlink);
         $newlink = home_url(user_trailingslashit($newlink));
         return $newlink;
       }
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [custom post type with post_id in permalink structure](https://wordpress.org/support/topic/custom-post-type-permalink-structure/)
 *  [willroy](https://wordpress.org/support/users/willroy/)
 * (@willroy)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/custom-post-type-permalink-structure/#post-1526634)
 * dpchen, thanks for that, really useful..
 * How could I modify that so I could include the post’s slug AS WELL as id i.e:
 * `http://url.com/myposttype/this-is-a-custom-post-type-entry/12`
 * or
 * `http://url.com/myposttype/this-is-a-custom-post-type-entry-12`
 * or
 * `http://url.com/myposttype/12-this-is-a-custom-post-type-entry`
 * Whichever is easiest?
 * Thanks for any suggestions
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[My Calendar - Accessible Event Manager] [Plugin: My Calendar] my_calendar_upcoming not returning events](https://wordpress.org/support/topic/plugin-my-calendar-my_calendar_upcoming-not-returning-events/)
 *  Thread Starter [willroy](https://wordpress.org/support/users/willroy/)
 * (@willroy)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/plugin-my-calendar-my_calendar_upcoming-not-returning-events/#post-1882730)
 * OK I did clean install of plugin including deleting the tables in the DB and 
   it’s sorted.. must have got a bit corrupt or the upgrade from 1.4 – 1.7.2 did
   something? Cheers anyway.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[My Calendar - Accessible Event Manager] [Plugin: My Calendar] my_calendar_upcoming not returning events](https://wordpress.org/support/topic/plugin-my-calendar-my_calendar_upcoming-not-returning-events/)
 *  Thread Starter [willroy](https://wordpress.org/support/users/willroy/)
 * (@willroy)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/plugin-my-calendar-my_calendar_upcoming-not-returning-events/#post-1882727)
 * I was on wp 3.03, but have now upgraded to 3.04, with still no luck and yes –
   I’m running 1.7.2 of My Calendar.
 * Interestingly enough I’ve just noticed that the event information are not not
   displaying in the my_calendar output.. just an empty box appears when the days
   is clicked on where there would normally be the event info..
 * I think I will delete the plugin files and re-install to see if that changes 
   things..
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Highrise Contact] [Plugin: WP Highrise Contact] Warning: simplexml_load_string()](https://wordpress.org/support/topic/plugin-wp-highrise-contact-warning-simplexml_load_string/)
 *  Thread Starter [willroy](https://wordpress.org/support/users/willroy/)
 * (@willroy)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/plugin-wp-highrise-contact-warning-simplexml_load_string/#post-1710201)
 * Ok this error message goes once you enter the Highrise creds. As a tip, an info
   box letting me know this would help!
 *   Forum: [Requests and Feedback](https://wordpress.org/support/forum/requests-and-feedback/)
   
   In reply to: [Subcategories for Links](https://wordpress.org/support/topic/subcategories-for-links/)
 *  [willroy](https://wordpress.org/support/users/willroy/)
 * (@willroy)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/subcategories-for-links/#post-1084006)
 * thirded
 *   Forum: [Alpha/Beta/RC](https://wordpress.org/support/forum/alphabeta/)
    In 
   reply to: [When is the 2.8 version release?](https://wordpress.org/support/topic/when-is-the-28-version-release/)
 *  [willroy](https://wordpress.org/support/users/willroy/)
 * (@willroy)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/when-is-the-28-version-release/#post-1081442)
 * I am looking forward to seeing what the new theme / plugin editor looks like;
 * So! 10, 9, 8, 7, 6, 5, 4, 3, 2 …
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [how to query database?](https://wordpress.org/support/topic/how-to-query-database/)
 *  [willroy](https://wordpress.org/support/users/willroy/)
 * (@willroy)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/how-to-query-database/#post-760856)
 * $wpdb->get_results returns an array so you wanna loop the results out:
 * $pageposts = $wpdb->get_results($sql, ARRAY_N);
    while($row = mysql_fetch_array(
   $pageposts)) {
 *  echo $row[‘fieldname’];
 * }
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [creating several static pages menu links](https://wordpress.org/support/topic/creating-several-static-pages-menu-links/)
 *  [willroy](https://wordpress.org/support/users/willroy/)
 * (@willroy)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/creating-several-static-pages-menu-links/#post-968661)
 * Instead of creating a new post, create a new page instead.

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/users/willroy/replies/page/2/?output_format=md)
[→](https://wordpress.org/support/users/willroy/replies/page/2/?output_format=md)