Strip from or something better?

Manipulating HTML with regular expressions is not a good idea. I suggest you use DOMDocument: // input $html = apply_filters(‘the_content’, get_the_content()); $dom = new \DomDocument(); $dom->loadHtml($html); $blockquotes = $dom->getElementsByTagName(‘blockquote’); foreach($blockquotes as $blockquote){ foreach($blockquote->childNodes as $e){ if($e->nodeName === ‘p’){ // create a text node with the contents of the <p> $blockquote->insertBefore($dom->createTextNode($e->textContent), $e); // remove <p> $blockquote->removeChild($e); … Read more

Get value from db for custom contact form

Add this at the start of your process.php file to get access to get_option and other wordpress functions: define( ‘WP_USE_THEMES’, false ); require(‘wp-blog-header.php’); You might have to change the path to wp-blog-header.php.

WordPressUser Submission Form

When you get those “headers already sent” messages, it is usually one of several things: You are echoing something when you shouldn’t be, which is any time before get_header on the front end. I can’t remember exactly where the window is on the backend. You are doing something that is triggering a warning or notice … Read more

OG:Audio facebook meta tags

You are probably using this code in your theme’s header.php. When this file is loaded $post is not available yet (it’ll be inside the Loop). So you’d need to declare before anything global $post;. But that’s not the best approach. If you swap themes, what? Do it again? See: Where to put my code: plugin … Read more

Display movies that apear this day next

What you want to do in this case is to use a meta_query in WP_Query like the following. You can reference the following Codex for more information https://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters. Once you have the posts. Loop over them and add their date as data attribute, and filter the items using data attributes. $args = array( ‘post_type’ => … Read more

How to list users like an archive page 10 users on page and have navigations

First of all, you would use WP_User_Query instead of WP_User class to find the list of users. I wrote up a snippet to demonstrate this. I haven’t tested it, so you might want to rewrite the whole thing. For reference, checkout this blog post http://mattvarone.com/wordpress/list-users-with-wp_user_query/ and the codex http://codex.wordpress.org/Class_Reference/WP_User_Query#Pagination_Parameters $per_page = 10; $offset = isset($_GET[‘offset’]) … Read more

the_meta – no get_the_meta query?

You are getting an error because get_the_meta isn’t a function. Just because many the_* functions have a corresponding get_the_* function, it doesn’t mean that all do. What you want is get_post_meta or get_post_custom. Those will return arrays which you will have to loop over and format yourself. the_meta uses get_post_custom. You can use its code … Read more

Covert WordPress Blogname into JQuery

Use wp_localize_script function set_js_var() { $translation_array = array( ‘blog_name’ => get_bloginfo(‘name’) ); wp_localize_script( ‘jquery’, ‘my_data’, $translation_array ); } add_action(‘wp_enqueue_scripts’,’set_js_var’); If you look at the source of the page you will see something like: <script type=”text/javascript”> /* <![CDATA[ */ var my_data = {“blog_name”:”WordPress 3.5.1 Release”}; /* ]]> */ </script> That is your Javascript variable. You have … Read more