Conditional for Post Format

There is no “default” post format type, though internally in core, a post that has no post format assigned is usually referred to as standard. So, your first conditional will return false using post-format-normal because there is no such post format – but would still return false using post-format-standard. You could reverse the conditional, and … Read more

Toolbar Hidden in a Virtual Page

The admin bar is initialized on template_redirect. You must be short-circuiting that. The quick and dirty method would be to run _wp_admin_bar_init(); near the top of your page. add_filter(‘wp_title’, function($title, $sep, $seplocation) { return ‘Register’; }, 10, 2); _wp_admin_bar_init(); // <- this <- get_header(); get_template_part(‘includes/breadcrumbs’); get_template_part(‘includes/top_info’); It would be somewhat neater to simply hook your … Read more

How to pass hook variable to function?

You can’t use an action or hook within a function in the way you are expecting. Actions and hooks are about delayed execution You are attaching code that will execute at a later point. After an action is added, your function will continue as normal. Then when the user is actually being registered, your code … Read more

setcookies and header send

The issue you have appears because you set your cookies too late. You have to set it before anything will be rendered. Set your cookies in the your-plugin-file.php file. Also you can check if headers were sent or not by calling headers_sent() function: add_action( ‘init’, ‘wpse8170_init’ ); function wpse8170_init() { if ( !headers_sent() ) { … Read more

Get URI from PodPress using PHP

$meta = get_post_meta(get_the_ID(), ‘_podPressMedia’, true); $meta = maybe_unserialize($meta); if (is_array($meta) && count($meta) > 0) foreach($meta as $item){ //do something… } Please, do not use unserialize/serialize with php data stored structures there is native maybe_serialize/maybe_unserialize. Retriving single value from postmeta table also doesn’t require get_post_custom, all you need to do to use get_post_meta whish will return … Read more

Showing Subcategory Name/Link Instead of Parent Category

Once you can’t know the order of categories returned by get_the_category, I suggest to loop through the categories and fill two arrays, one for parent and one for children. After that if the parents array is empty showing the children, otherwise show the parents: $categories = get_the_category(); if ( ! empty($categories) ) { $parents = … Read more

Use an anchor link to open an iframe inside a WordPress page

I would approach this one of two ways: Use a target attribute in the link to open it in an iframe (not universal across browsers) Use JavaScript to replace the src attribute on your iframe Option 1: <a href=”https://wordpress.stackexchange.com/questions/118983/somethirdpartysite.com/reg” target=”thirdparty”>Register</a> <iframe name=”thirdparty”></iframe> Option 2: <a href=”https://wordpress.stackexchange.com/questions/118983/somethirdpartysite.com/reg” class=”iframeit”>Register</a> <iframe src=”#” name=”thirdparty”></iframe> <script> $(‘.iframeit’).click(function(event) { event.preventDefault(); var … Read more

Using flickr api in custom wordpress plugin

I see two issues right off the bat that are going to cause problems: $this->myApiKey = $flickr_key; $thix->myApiSecret = $flickr_secret; myApiKey and myApiSecret aren’t in your code anywhere, so setting them here isn’t doing anything. They should be $this->flickr_key and $this->flickr_secret. You have a typo in the 2nd line above. Change $thix to $this and … Read more

How to make the WordPress Editor not accept HTML?

Remove post type support for the editor: add_action( ‘init’, function() { remove_post_type_support( ‘post’, ‘editor’); } ); Now add a new meta box containing only a textarea // print a new meta box function generic_cb($post) { $content = (!empty($post->post_content)) ? $post->post_content : ”; echo ‘<textarea name=”content”>’.$content.'</textarea>’; } function add_before_editor($post) { global $post; add_meta_box( ‘generic_box’, // id, … Read more