somtam
Forum Replies Created
-
Forum: Plugins
In reply to: [Advanced Custom Fields (ACF?)] problem with WP 3.5.1thanks man!
Forum: Fixing WordPress
In reply to: Delete the default page queryso it would be correct if with query_posts I shut down all the query and then I make my custom query with WP_Query? if yes, how to shut down the query with query_posts?
thanks!
Forum: Everything else WordPress
In reply to: Single and Page template not work any morethe problem was due to the rewrite declaration of a custom taxonomy i had in the template. It was like:
'rewrite' => array( 'slug' => '' ),
so better to give a value or not put.
Thanks
Forum: Fixing WordPress
In reply to: Check the Content Permissionserrata corrige
in the if I forget to check the case in which there’s no restricted content… in that case the $roles_can array is empty. So:
if ( empty( $roles_can ) ) { return true; } else { if ( in_array( $user_role, $roles_can ) || current_user_can('edit_post', $post->ID ) ) { return true; } else { return false; } }
Forum: Fixing WordPress
In reply to: Check the Content PermissionsI wrote a function to check the content permissions ( return bolean ):
function my_check_the_user() { global $current_user; global $post; $user_roles = $current_user->roles; $user_role = array_shift($user_roles); $roles_can = get_post_meta( $post->ID, '_members_access_role', false ); if ( in_array( $user_role, $roles_can ) || current_user_can('edit_post', $post->ID ) ) { return true; } else { return false; } }
Forum: Fixing WordPress
In reply to: Check the Content PermissionsI found something.
There’s a value saved lika a post meta. This is the _members_access_role.
So the get the roles that can access the post do this:$roles_can = get_post_meta( $post->ID, ‘_members_access_role’, false );
the third parameter is set to false because it could have multiple value ( array of roles ).
bye!
Hello and thanks for reply and make your plugin even better!
But I have a problem… I do not understand how to select the menu on which I want to apply your responsive menu.
In the options of your plugin I already set on OFF the Active all theme locations.
In my Appereance > Menu I have several menu I use in my template. I call them with the function <?php wp_nav_menu(array(‘menu’=>’main’)); ?>.thanks!
Forum: Hacks
In reply to: prepare() for an sql processing different number of idsorry I don’t understand… you are saying that my code is correct without using prepare()?
Forum: Hacks
In reply to: prepare() for an sql processing different number of idThanks for answer.
After reading that article I tried this:$sql = $wpdb->prepare("DELETE FROM {$wpdb->prefix}table WHERE id IN (%s)", $id_arr); $result = $wpdb->query($sql);
but the result is that Wp delete only 1 record and not all the one with the ID inside the array… can you help to understand where is the mistake?
thanks!
Forum: Fixing WordPress
In reply to: WordPress 3.5 upgrade breaks all Ajax features…I’ve just installed the 3.5 release from scratch, and there’s problems I think due to ajax. Can’t reorder the menu element with the usual drag and drop.
The Help and the Screen Options don’t slide down, and stay in position.
Moreover Is impossible to edit the appearance of the themes.Is the release? do you have the same problems?
Only in Chrome, safari and firefox are ok!!
Forum: Plugins
In reply to: [Map Cap] Map Cap gives problems with permalink?Sorry, was not due to Map Cap, but to a wrong function ??
Forum: Hacks
In reply to: sql with relationship between wp_post and wp_postmetaDrew, Yes! you’re right!
and when I’m in the artist page, to let people know at which Events they’re going to partecipate I do inside the loop, every cycle, another query like:$args = array(
‘post_type’=>’events’,
‘meta_key’ => ‘_artist_id’,
‘meta_value’ => $post->ID,
);
$sql = new WP_Query( $args );do you think is correct?
thanks a lot!Forum: Everything else WordPress
In reply to: Relations between images, posts and databaseyes, that’s what I discover, and to be honest I think is a non sense.
But anyway, make the query I wrote above returned wrong data, right?Better to do something like this in the loop:
preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); $imgs = $matches[1];
this gives the url of the images (use $matches[0]) to get the html of the images.
that’s a good and simple idea.
thanks!Forum: Fixing WordPress
In reply to: wp_get_attachment_image_src: how to get the title of the images?thanks! I didn’t see it gives the attributes too!