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

Single dash converted to double dash

It’s lines 396 – 398 in the smart youtube plugin’s smartyoutube.class.php file: function check($the_content, $side = 0) { if (strpos($the_content, “httpv”) !== false ) { $char_codes = array(‘&#215;’, ‘&#8211;’); // <– 8211 is an en dash $replacements = array(“x”, “–“); // <– here’s where it’s swapping in — $the_content = str_replace($char_codes, $replacements, $the_content); // <–