is_single(); Question

You should have a look at using conditional tags in wordpress. is_single() is the conditional tag for a single page, ie single.php. For homepage, is_home() or is_front_page() should be use, depending on whether a front page is set in settings or not.

Set a variable to using in redirected page

I think wp_login is executing before functions.php is actually opened, thus not setting the global variable. One possible solution to this is instead append to the URL: function open_menu($user_login) { wp_redirect(home_url().’?menu_open=true’); exit; } add_action(‘wp_login’, ‘open_menu’); Then you could get that value via if(isset($_GET[‘menu_open’]) && $_GET[‘menu_open’])

Page templates in subdirectories and auto generator

Instead of having a page template for all of them, have a single page template and use get_template_part to pull in the parts unique to each page. So instead of: update_post_meta($new_page_id, ‘_wp_page_template’, $page_filename); You’d have: update_post_meta( $new_page_id, ‘_wp_page_template’, ‘newpagetemplate.php’ ); update_post_meta( $new_page_id, ‘sagive_page_type’, $page ); Then inside your new page template: $type = get_post_meta( get_the_id(), … Read more

Display pages in alphabetical order

Filter pre_get_posts is used for modifying the query from theme or plugin. This hook is called after the query variable object is created, but before the actual query is run. Codex documentation of pre_get_posts Although this filter is very handy and useful, we need to be very careful using it. We should very careful about … Read more

Need 404 behaviour for blank parent page

In functions.php function productsPageRedirect_404() { global $post; if( is_page(‘products’) ) { global $wp_query; $wp_query->set_404(); status_header(404); } } add_action( ‘wp’, ‘productsPageRedirect_404’ );

Do I have to widgetize my pages?

Use page templates and template parts. On your Front Page, you include the Texts as Template Parts: Front Page +—————+—————+—————+ | Page A | Page B | Page C | +—————+—————+—————+ | Link Page 1 | Link Page 2 | Link Page 3 | | Text 1 (TP1*) | Text 2 (TP2*) | Text 3 … Read more

Allow a user to edit their own page and profile only

Read the WordPress Codex on the subject of Roles http://codex.wordpress.org/Roles_and_Capabilities To confirm that the system works the way you want, as an admin create a test member with the author role and sample content as you would for a ‘real’ member. Then sign out and sign in using your test member’s credentials and see what … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)