Run JS Code on userlog out

wp_logout is being triggered server side when the user is logging out, but the fact that it is being triggered do not indicate that there is a browser on the other side that actually triggered it. For example a user might log out via Ajax and then the JS code will not be evaluated. In … Read more

Adding Additional Variables on Menus Page

Use the checked function. https://codex.wordpress.org/Function_Reference/checked The HTML you want to render should look like this: <input … value=”hide” checked=”checked” />Hide from these locations.</br> <input … value=”show” />Only show to these locations.</br> What you’re getting instead is probably somthing like this: <input … value=”hide” />Hide from these locations.</br> <input … value=”” />Only show to these locations.</br> … Read more

how can I include some custom variable from functions.php?

WordPress theme files are called thru functions/classes, so variables declared in functions.php are not recognized by other theme files, until you specify you want to use the global value of the variable. Do so like this in your theme template files: global $mysite_address_url; you can then use $mysite_address_url as you’d like. To read more about … Read more

Override index with a custom PHP page

Create a new theme folder next to your current theme and name it, ThemeName Child Theme In the new child theme folder create a file names style.css In the header of that file add this, /* Theme Name: My Child Theme Theme URI: http://www.example.com/myTheme Description: your Child Theme Author: your name Author URI: http://www.example.com Template: … Read more

Apache HTTP Server stops working for only a certain local website

First open your wp-config.php which is located in the root WordPress directory. Then add the following line inside the main php tag: define(‘WP_MEMORY_LIMIT’, ’64M’); We just increased the memory limit to 64M. If you still get the error after this fix, then please contact your host. Most likely, they would have to go in their … Read more

Initial offset of number of posts in home page on the posts page

One way might be to set posts_per_page for the query to 13 and then override the $paged global (before the query is called) to force it to 2 if it is only 1… eg. if ( (is_post_type_archive(‘post’)) { global $paged; if ( ($paged == 0) || ($paged == 1) ) {$paged = 2;} }

Call to undefined function error in plugin

You can try following while you get such error: Searched for the php file with the function definition in it. Verified that the file exists. Verified that the require (or include) statement for the above file exists in the page. Also, verified the absolute path in the require/include is correct. Verified that the filename is … Read more

Create a a form for custom taxonomy terms

at the simplest level, you could put the options in a select list which would allow a user to ctrl + click to select multiple terms for your form submission. (For something fancier, use javascript/jquery/etc) You can then write a return function that uses wp_query to filter on the terms (you didn’t specify if you … Read more

Creating a child theme after numerous edits to parent theme

[*] If I were you… download original theme. caution: same version install git from https://git-scm.com/downloads [*] do Git Init in original theme, git add && git commit move .git folder (hidden) to your edited theme use git status, git diff… etc Be happy [*]Git detects all the diferences in your work directory. ciao [*]