C8H10N4O2
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Forum index under subdomain considered as home by WordPressAdditionally, you may need to filter nav_menu_css_class to remove the current-menu-item class from the home link when you’re on the forum index.
For example, here is the code I’ve used :
function my_special_nav_class( $classes, $item ) { if( defined('PUN_ROOT') && $item->title == 'Home' ) { $remove_key = array_search( 'current-menu-item', $classes ); unset($classes[$remove_key]); } return $classes; } add_filter( 'nav_menu_css_class', 'my_special_nav_class', 10, 2 );
You can add the following snippet before
return $classes;
to add thecurent-menu-item
class to the “Forum” link in the navigation. Be sure to use the title of your link if it’s not “Forum”.if( defined('PUN_ROOT') && $item->title == 'Forum' ) { $classes[] = 'current-menu-item'; }
Forum: Fixing WordPress
In reply to: Forum index under subdomain considered as home by WordPressFrom what I understand at the moment :
is_home
use the WordPress Query API to know if the page is the home or not.If there is no query, as for the forum index page,
is_home()
will return true.By navigating in the forum, you append things to the URL i.e. you set a query so
is_home
returns false.Anyway, the quick fix is to use something to check if you are in the forum context, like for example if
(defined('PUN_ROOT'))
.Don’t hesitate to post if you have any better idea or explication ! It’s more than possible my explications are false as I have a limited understanding of PHP and WordPress. Thanks again.
Forum: Plugins
In reply to: [Attachments] Search results based on filenames.Thank you very much for your answer.
I’ll stay with a simple
$attachments->search()
on the name of the attachment for my project.I’ll post a feature request on Github regarding the possibility to include the filename in Attachment’s metadata.
Again, thanks for this great plugin.
Forum: Plugins
In reply to: [Active Directory Integration] No Login/Authentication – Where Is It?Hi,
This plugin allows you to authenticate a WORDPRESS user against an active directory server.
A wordpress blog is readable by non-authenticated visitors.
In order to achieve what I think you are trying to do, you’ll need either to make the blog readable for suscribers (and other wordpress roles) only, or to use Apache LDAP authentication.
The form you’re looking for is the one displayed by puting wp-admin/ at the end of your blog’s URL.
Forum: Plugins
In reply to: [Attachments] Search results based on filenames.Thanks for your answer.
Querying wordpress on the filename of an attachment seems quite difficult since the only field where this information is available is the guid in the wp_post table. I think
WP_query
can’t help here so a custom$wpdb
query may be needed.Anyway I’m no developper and can’t do that so I decided to go with
get_posts
, which seems to search for thepost_title
, which is the filename without the extension in the case of an attachment.So this way I retrieved a list of
attachment_ids
but then I have to search for thoseattachment_ids
using$attachments->search()
.But I don’t think I can do it with one
$attachments->search()
only : it seems like only oneattachment_id
is authorized in the$attachments->search()
parameters list. Am I wrong ? (Feature request ?)I may succeed by doing a loop on the
attachment_ids
and as much searchs as ids I have, and then merge all the objects…Am I over-complicating things ?
Maybe there is a workaround, like setting a new field “filename” in my instance, and pre-populate the field with the filename when a user attach a file to a post ? Is this possible (with a hook?) ?
Many thanks !