Does wp_mail work in frontend tempate file?
My question is if it can be used be not logged in users or not. Yes. wp_mail() works fine from the front end when not logged in. I use it for a contact page on my web site.
My question is if it can be used be not logged in users or not. Yes. wp_mail() works fine from the front end when not logged in. I use it for a contact page on my web site.
The domain didn’t have www. in the wordpress settings. Adding this worked. No idea what the problem was exactly, but this solved it. Edit: Not yet fixed. It was mod_security which blocked ‘WordPress.com.’ (I’m at Namecheap which uses mod_security)
One possibility would be to hook into the bbp_template_before_forums_index like this: add_action( ‘bbp_template_before_forums_index’, ‘wpse118937_bbpress_forum_list_desc’); function wpse118937_bbpress_forum_list_desc() { //add your description code here } This will be displayed after the breadcrumbs and before the list. If you want more extensive customizations you can customize the template for that, but you shouldn’t do that in the plugin … Read more
Your pre_get_posts filter is incorrect. You are altering more queries than I think you think you are. The “main” query isn’t just the primary index. You are adding (or attempting to add) all of those post types to every page, basically,– the author archives, the categories, everything. Try this: add_action( ‘pre_get_posts’, ‘add_my_post_types_to_query’ ); function add_my_post_types_to_query( … Read more
The function get_page() has been deprecated, don’t use it anymore, use get_post() instead. get_page_by_title() returns an object by default, you can change this by altering the $output parameter, which you can use like you did. Although get_post() can take an object as $id parameter I personally prefer inputing the ID, but that actually shouldn’t matter. … Read more
In your single.php add this example code inside the loop: <?php global $page; if ($page == 1) {?> <div style=”color:red;”>This text should only appear on first page of the post!!!</div> <?php } ?> you can change the div with your thing that you wanted to display only on the first post page..
Your question is vague: i’ll try to be as specific as possible. The basic rule is: if you need to modify the default query, use pre_get_post If you need to display another list of results than the one linked to your template url, use get_posts. I find this documentation to be quite useful http://developer.wordpress.com/2012/05/14/querying-posts-without-query_posts/ Doc … Read more
You should create a new page template based on your current page template. Without any example code it is hard to give you a specific example, but here’s an approach: Copy page.php to a new file and name it page-wide.php. The prefix page- is significant because it triggers WordPress’ template hierarchy. At the top of … Read more
You are not wrong about conceptual limitation, but any development convention is inherently about constraints. Constraints are “bad”, but they are also often good and important. In this specific case it’s slightly soured by Settings API being especially nasty snowflake, which historically led people to reinvent this particular wheel a lot. However, your estimate of … Read more
All sorted. For any one interested, I simply added in a function (into functions.php) that redirected to my new template dependent on the name of the post (you could also use the ID). add_filter(‘template_include’, ‘new_template’); function new_template($template){ global $post; if($post->post_name == ‘mortgage’){ $template = get_template_directory() . ‘/mortgage-template.php’; } return $template; }