Tag Info

New answers tagged

0

I really should just try to think things out thoroughly before instantly asking questions. I found a very easy solution. It's not exactly adding "pages" but it does what I need. When registering the custom post type, there are two things which need to be specified. By default, the parameter hierarchical is set to false. Solution: set hierarchical => ...


0

The normal practice is to generate URL on PHP side ( admin_url() ) and provide it to your script via localization functionality ( wp_localize_script() ). It is documented in Codex under Ajax on the Viewer-Facing Side.


0

From the documentation IMPORTANT: By default, WordPress will not recognize custom querystring variables used for rewrites. You must register your querystring variables with WordPress. Simply use add_rewrite_tag() to capture querystring variable values after a rewrite, or the above rewrite will not work! I believe WordPress is not recognizing ...


0

You should use $_SERVER[] global array to get the url of the page. The simplified syntax is: $request_url=$_SERVER['REQUEST_URI']; You can then use the variable $request_url where you need the url.


0

have you looked at $_SERVER $real_address = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; echo $real_address; This code grabs your url with it's parameters and saves it to the $real_address variable Also have a look at this link here


0

Use add_rewrite_rule() function custom_rewrite_rule() { add_rewrite_rule('^nutrition/([^/]*)/([^/]*)/?','index.php?page_id=12&food=$matches[1]&variety=$matches[2]','top'); } add_action('init', 'custom_rewrite_rule', 10, 0); you can use if ( 'myposttype' == $post->post_type ){} to make it post type specific. Weather you want to ...


0

A few hours ago, I was wondering how to do that too. But, soon I got the solution and made a plugin, please check whether get_avatar_url($user_id, $size) works for you or not. Thanks.. Plugin code: /* Plugin Name: Get Avatar URL Plugin URI: https://github.com/faizan1041/get-avatar-url Description: get_avatar returns image, get_avatar_url will give you ...


0

A combination of answers for you. To remove the "wordpress" from your URL path, I would recommend the following step-by-step on "Using a pre-existing subdirectory". http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory#Using_a_pre-existing_subdirectory_install The end result will be your Wordpress content pages at "mydomain.no" instead of ...


0

Readadd_menu_page carefully: $menu_slug (string) (required) The slug name to refer to this menu by (should be unique for this menu). Prior to Version 3.0 this was called the file (or handle) parameter. If the function parameter is omitted, the menu_slug should be the PHP file that handles the display of the menu page content. Default: None


5

First of all I have to say that wp_get_referer() is not 100% reliable because it relies on $_SERVER['HTTP_REFERER'] that is not 100% reliable, from php.net docs: The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify ...


0

You could use template_redirect hook to redirect your pages, like this: function my_page_template_redirect() { global $wp_query; $object = $wp_query->get_queried_object(); //this returns queried object. Check the conditions and redirect } add_action('template_redirect', 'my_page_template_redirect');


0

If you choose to use contact form 7 plugin then you can find very detailed instructions here. Basically you need to create a custom filter using wpcf7_form_action_url hook. Another option would be to create child-theme and create your custom form there, but that IMHO would be a bit of an overkill.



Top 50 recent answers are included