Country Ways Content Show

This is actually quite easy to do: You will need to install a geolacation plugin that provides methods/functions to identify visitor country. N.B. A plugin only providing shortcodes will not work. The only complicating factor is countries can be named in a variety of ways so 2 character ISO Country Codes have to be used … Read more

Encode code snippet in AJAX endpoint

I think your answer is about escaping not execution, e.g.: Why does this text appear bold versus: <b>Why does this text appear bold</b> The problem is escaping, but first, some notes: The Problem With Calling it Execution Executing is the wrong word to use, which is why your googling did not yield results. No PHP … Read more

Single Loop With Dual Content Area

Lets first start with a bit of knowledge-base: the_content is this /** * Display the post content. * * @since 0.71 * * @param string $more_link_text Optional. Content for when there is more text. * @param bool $strip_teaser Optional. Strip teaser content before the more text. Default is false. */ function the_content( $more_link_text = null, … Read more

How to make a website like the ones in theme demos? [closed]

Theme demos, especially commercial ones, do not display out-of-the-box state of it. They are hand crafted and fine-tuned setups designed to sell (or at least convince for free ones). The official set of content that is typically used for quickly reviewing, evaluating and testing theme is called Theme Unit Test data. There are also unofficial … Read more

WordPress Shortcode loads at the top

First, declare your variable: $return = ”; Then, throughout the code, concatenate items: $return .= ‘<div class=”sp shadow”><img src=”https://wordpress.stackexchange.com/questions/81864/…”></div>’; $return .= ‘<h3>Videos</h3>’; And finally, return the result: return $return;

Creating a custom page & output on a Plugin

You can use the “page_template” filter to load a custom template for a given page. It will replace the template used whenever the “page” template is called. Remember to add the template file somewhere on your plugin folder. add_filter( ‘page_template’, ‘custom_template_function’ ); function custom_template_function( $page_template ) { if ( is_page( ‘my-custom-page-slug’ ) ) { $page_template … Read more

Function to get content by ID

Instead of using get_posts, which you would use if you wanted to retrieve multiple posts in a loop, you should use get_post, which only retrieves one post by an ID. There is also a built-in excerpt so you might want to go with retrieving post_excerpt. function get_the_excerpt_id($post_id) { $find = get_post($post_id); $excerpt = $find->post_excerpt; $excerpt … Read more