is_home() returns TRUE on page template
I discovered that it isn’t actually a bug. In the loop is_home() will refer to the currently looped object and not to the page that you accessed. In fact that’s handy!
I discovered that it isn’t actually a bug. In the loop is_home() will refer to the currently looped object and not to the page that you accessed. In fact that’s handy!
If you’re getting Index of /blog Apache Server Port 80 instead of a 404 page, you might be having a folder called blog in on your server. Try deleting or renaming that folder if you’re not using it. EDIT: Here is a related question: WP Page and Subdirectory with same name
You can assign any page– “Page”, not blog post or CPT post/page– to be the “blog posts” page by going to wp-admin->Settings->Reading, clicking the “A static page” radio box and selecting a static home page and blog page from the drop down menus. If that isn’t what you want, or if that doesn’t work, then … Read more
Not sure about the best practices, but I have a few custom login-sensitive pages which simply display a message if user is not logged and is trying to view the page directly: $logged_in = is_user_logged_in(); if($logged_in) { ?> <article id=”post”> <?php the_content(); ?> </article> <?php } else { _e(‘You are not logged in. Please ‘, … Read more
You could use Gravity Forms and generate a draft of a custom post type on submission. The form could contain the URL and all other fields. Nice thing about Gravity Forms is the fields can all be validated and has decent anti-spam measures. It also has hooks to do other tasks such as the post-generation. When … Read more
When clicking a link from a post to a page you can concatenate the post_id to the end of the link as a GET variable. So let’s say you had a link within the WordPress loop you can easily add the post_id as a GET variable as such <?php if (have_posts()): while(have_posts()): the_post(): ?> <a … Read more
STYLING With a static navigation, the CSS you mentioned, won’t work. Use the simple HTML parameters: #access a:link, #access a:active, #access a:visited{ font-weight: bold; } CODING In my project, I used echo get_the_category_by_ID( 11 ); to echo the Category name of the cat_ID = 11. You can show the cat name by this. For page … Read more
Your since83_pagination() function is assuming the main query– $wp_query— but you are needing to paginate something very different. You need to be paginating the results in $attachments which you are retrieving with get_children(). That was my guess as soon as I saw this question. You are going to need to rethink this. There are two … Read more
template_redirect and wp (as the OP noted in comments) are good hooks to do this. But there’s a problem of logic in the sample code. I think it should be like: add_action( ‘template_redirect’, ‘cookie_redirect_wpse_113662’ ); function cookie_redirect_wpse_113662() { # No cookie set, let’s do it if( !isset( $_COOKIE[‘site_language’] ) ) set_cookie_wpse_113662( ‘ar’ ); # One … Read more
This is an issue when installing mod_security2. The solution is as simple as disabling mod_security or allowing that page to POST that request. The issue is that mod_security thinks someone is trying to hack into your site.