zebrastribe
Forum Replies Created
-
Forum: Plugins
In reply to: [Login for Google Apps] Shortcode for login?Hi Dan
Thank you for the quick reply it worked perfectly…Great plugin by the way ??
Forum: Hacks
In reply to: Exclude categoies from wp_list_categories?oh my …stupid me and my fat fingers.
this seems to work:
<?php $taxonomy = 'category'; // get the term IDs assigned to post. $post_terms = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) ); $post_terms_ex = array (1); $result_post=array_diff($post_terms, $post_terms_ex); // separator between links $separator = ', '; if ( !empty( $result_post ) && !is_wp_error( $result_post ) ) { $term_ids = implode( ',' , $result_post); $terms = wp_list_categories( 'title_li=&style=none&echo=0&taxonomy=' . $taxonomy . '&include=' . $term_ids ); $terms = rtrim( trim( str_replace( '', $separator, $terms ) ), $separator ); // display post categories echo $terms; } ?>
Is there a better way then is code?
when I google “array_diff()” it seems that a lot of posts is about that is slow on large arrays. How large is large?
Forum: Hacks
In reply to: Exclude categoies from wp_list_categories?Tried this but it does not work…
<?php $taxonomy = 'category'; // get the term IDs assigned to post. $post_terms = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) ); // separator between links $separator = ', '; if ( !empty( $post_terms ) && !is_wp_error( $post_terms ) ) { $term_ids = implode( ',' , $post_terms ); $terms = wp_list_categories( 'title_li=&style=none&echo=0&taxonomy=' . $taxonomy . '&include=' . $term_ids ); $terms = rtrim( trim( str_replace( '', $separator, $terms ) ), $separator ); $terms_ex = wp_list_categories( 'title_li=&style=none&echo=0&taxonomy=' . $taxonomy . '&include=1' ); $terms_ex = rtrim( trim( str_replace( '', $separator, $terms ) ), $separator ); // display post categories $result=array_diff($terms_ex,$terms); echo $result; } ?>
Forum: Hacks
In reply to: Exclude categoies from wp_list_categories?Thanx bcworkz.
How would the new code look with the array_diff() if I used the standard code from the codex<?php $taxonomy = 'category'; // get the term IDs assigned to post. $post_terms = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) ); // separator between links $separator = ', '; if ( !empty( $post_terms ) && !is_wp_error( $post_terms ) ) { $term_ids = implode( ',' , $post_terms ); $terms = wp_list_categories( 'title_li=&style=none&echo=0&taxonomy=' . $taxonomy . '&include=' . $term_ids ); $terms = rtrim( trim( str_replace( '', $separator, $terms ) ), $separator ); // display post categories echo $terms; } ?>
Forum: Hacks
In reply to: Exclude categoies from wp_list_categories?Can I may make the exclude on:
$post_terms = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );
so that the categories do not show up in the list?
Forum: Hacks
In reply to: Exclude categoies from wp_list_categories?Well, I think it is because it shows some errors from yesterday…
<?php $taxonomy = 'category'; // get the term IDs assigned to post. $post_terms = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) ); // separator between links $separator = ', '; if ( !empty( $post_terms ) && !is_wp_error( $post_terms ) ) { $term_ids = implode( ',' , $post_terms ); $terms = wp_list_categories( 'title_li=&style=none&echo=0&taxonomy=' . $taxonomy . '&exclude=1' . '&include=' . $term_ids ); $terms = rtrim( trim( str_replace( '<br />', $separator, $terms ) ), $separator ); // display post categories echo $terms; } ?>
And this is showing the right two categories for this specific post on index.php
Forum: Hacks
In reply to: Exclude categoies from wp_list_categories?Okay. I am on mamp and the php_error.log does not show an error?
Forum: Hacks
In reply to: Exclude categoies from wp_list_categories?Sorry. The categories is not outputted at all and the space is left blank
Forum: Hacks
In reply to: Exclude categoies from wp_list_categories?I tried:
1.<?php $taxonomy = 'category'; // get the term IDs assigned to post. $post_terms = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) ); // separator between links $separator = ', '; if ( !empty( $post_terms ) && !is_wp_error( $post_terms ) ) { $term_ids = implode( ',' , $post_terms ); echo '<pre>'; print_r($term_ids); echo '</pre>'; $terms = wp_list_categories( 'title_li=&style=none&echo=0&include=' . $term_ids ); $terms = rtrim( trim( str_replace( '', $separator, $terms ) ), $separator ); // display post categories echo $terms; } ?>
and
2.
<?php // get the term IDs assigned to post. $post_terms = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) ); // separator between links $separator = ', '; if ( !empty( $post_terms ) && !is_wp_error( $post_terms ) ) { $term_ids = implode( ',' , $post_terms ); echo ' <pre>'; print_r($term_ids); echo '</pre> '; $terms = wp_list_categories( 'title_li=&style=none&echo=0&include=' . $term_ids ); $terms = rtrim( trim( str_replace( '', $separator, $terms ) ), $separator ); // display post categories echo $terms; } ?>
with the first piece of code it shows 7, 1, Features, Uncategorized in a list with 7,1 inside the “pre” tag without a link.
(it is the right categories for this posts and there IDs)The second does not work..
Forum: Hacks
In reply to: Exclude categoies from wp_list_categories?No. Howto?
I got this from the codex:
exclude
(string) Exclude one or more categories from the results. This parameter takes a comma-separated list of category ids. The parameter include must be emptyAnd the example is like this:
$terms = wp_list_categories( 'title_li=&style=none&echo=0&taxonomy=' . $taxonomy . '&include=' . $term_ids );
is the include parameter empty if?
‘&include=’ . $term_idsForum: Hacks
In reply to: Exclude categoies from wp_list_categories?All the categories from the whole site is shown and the “1” is excluded.
What I need is:
Only the associated (to the post) categories with “1” excluded.
Like this from the codex
But I need to exclude one or more…Forum: Hacks
In reply to: Exclude categoies from wp_list_categories?Yes. I also need to specify more categories later. Maybe as a variable $exclude_cat?
Forum: Networking WordPress
In reply to: Media urlok. I see you point and thank you for explanation, sorry for my ignorance…
Which is the best procedure for updating the links inside the post?
Because now the new images are placed into “wp-content/uploads/sites/2/” and the old are with the “/files/” (which is in the “wp-content/uploads/sites/2/” folder)
At the moment the old is on domain.com and the new is on sub.domain.com but when all is up and running I will make the switch.
You talk about search/replace?
Forum: Networking WordPress
In reply to: Media urlHi Mika
Ok. The custom land is not the way for me…
Why does the old install exclude the “wp-content/blogs.dir/2/” from visitors url?
when the new install does not hide the “wp-content/uploads/sites/2/?I guess I hoped that there were some magic htaccess rewrite rule that could make it work…
Instead of having to relay on this plugin:
https://codecanyon.net/item/hide-my-wp-no-one-can-know-you-use-wordpress/4177158
Forum: Networking WordPress
In reply to: Media urlHi Mika
Thank you for your reply. I understand that the new way of placing the files is in the “uploads”-folder and I have no problem with the files being there but I would really like to have the url for the visitor as clean as possible and not include the wp-content/uploads/sites/ or /blogs.dir/
Like
https://domain.com/media/2008/06/image.jpgCan I be done?
If I understand you correctly you are talking about updating the database from “/files/” to “sites/2”, right?
Then the url will look like:
https://domain.com/wp-content/uploads/sites/2/2014/02/image.jpgCan the “wp-content/uploads/sites/” part be just f.ex “media”?
As I have seen the in roots.oi theme?