Passing HTML in WordPress Shortcode arguments

You have used the same quotation characters in 2 different contexts. You should write the shortcode in the following way: [example text=”<a href=”http://example.com”>lorem</a> ipsum”]Lets roll[/example] Then, “unescape” HTML entities on the shortcode output: $return_string = ‘<div class=”some-class”>’. html_entity_decode($text) . $content .'</div>’;

the_post_thumbnail fallback using hooks

you can use the post_thumbnail_html filter hook which passes 5 variables to your hooked function : $html – the Output html of the post thumbnail $post_id – the post ID. $post_thumbnail_id – the attachment id of the image $size – the size requested or default $attr – Query string or array of attributes. So something … Read more

How allow users to save list of posts?

When I am thinking about UI something like this is comming to my mind. Something similar has YouTube under the video. When user fills input and clicks enter or submit button to create list, you will send ajax request with list name and save it as a record in wp_usermeta table with meta_key _list_user_1 and … Read more

Preferred Use of home_url()?

Million ways in WordPress to use home_url() or sister functions. The question to ask is: What function is a wrapper for other function? To summarize, if you like to concatenate you may use: get_bloginfo(‘url’); get_option(‘home’); If you like to have the control over scheme (http or https) get_site_url( $blog_id, $path, $scheme ); get_home_url( $blog_id, $path, … Read more

My function doesn’t work into WordPress but outside, it works – what am I missing?

WordPress template files are included via functions, which places the scope of those included files within those functions. That’s why you have to declare it global twice. Here is an example you can try with 3 simple php files to illustrate this without using WordPress: main.php function include_file_1(){ include ‘1.php’; } function include_file_2(){ include ‘2.php’; … Read more