How do I use inline SVG in WordPress

According to this post, if you put all the svg block in one line, it will be rendered. This should work: <svg xmlns=”http://www.w3.org/2000/svg” version=”1.1″ height=”190″> <polygon points=”100,10 40,180 190,60 10,60 160,180″ style=”fill:lime;stroke:purple;stroke-width:5;fill-rule:evenodd;”> </svg>

Convert IPTC keywords to blog post tags

WordPres has a function that extract IPTC info from images, that function is wp_read_image_metadata. That function is only available on admin side and, according with the codex, it doesn’t extract IPTC keywords. But you can use iptcparse from PHP at your own to extract IPTC keywords and set them as post tags. In your question, … Read more

Hiding posts from non logged in users

Fiddling with user roles would probably be the most robust solution, however a quick and dirty approach would be to set post meta-data to mark posts that should be hidden, then add a meta-query to post queries by using a pre_get_posts hook in order to restrict results to non-hidden posts for non-logged-in users. The following … Read more

WordPress automatic and permanent page

Yes, that is doable. I don’t know about running scripts immediately after WP installation is complete, but you could implement your idea perhaps with a must-use plugin. First you probably want some kind of way to get the contact page id. A helper function for that, function get_my_contact_page_id() { return get_option( ‘my_contact_page’, 0 ); // … Read more

How do I create a featured post within a custom post type?

Register a video post type and a “Featured Taxonomy” “Featured Custom Meta Select Box The Post type: function c3m_reg_vid_post() { $labels = array( ‘name’ => _x(‘Videos’, ‘post type general name’), ‘singular_name’ => _x(‘Video’, ‘post type singular name’), ‘add_new’ => _x(‘Add New’, ‘video’), ‘add_new_item’ => __(‘Add New Video’), ‘edit_item’ => __(‘Edit Video’), ‘new_item’ => __(‘New Video’), … Read more

Post visibility on the basis of roles

Give your custom roles the capability to “read_member_posts” or whatever. Then you could apply a filter to the_content() add_filter( ‘the_content’, ‘my_wpse20347_filter’ ); function my_wpse20347_filter( $content ) { global $post; if( author_can( $post->ID, ‘edit_posts’ ) || current_user_can( ‘read_member_posts’ ) ) { return $content; } else { // Everyone else sees this in place of the content. … Read more

Post Size Limit

In the following snippet, you’ll see all filters attached to the title, content & excerpt (from /wp-includes/default-filters.php). Try to remove in a first try only stuff like capital P dangit, smilies and such and if this doesn’t work, remove the more critical stuff. I’d only do this until the post saves and then move stuff … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)