Hot answers tagged table
3
I think your question is a perfect example for the XY Problem. In WordPress you do not create such a menu in a post editor. You use a menu.
Once you start thinking about your problem from this point, everything is easy. :)
First register a custom navigation menu for this list in your theme’s functions.php:
add_action( 'wp_loaded', ...
2
Write a function that uses $wpdb->prefix as a fallback. Something like this:
function wpse65880_table_with_prefix($table) {
// should define array in config file, rather than hard coding
$my_tables = array("table1", "table2", "table3", "table4");
if (in_array($table, $my_tables)) {
// "qa_" should also be a config file setting
...
2
Please take a look at user_register hook
This is fired when a new user is registered and conveniently passes you the user ID of the new user.
function function_name( $user_id )
{
/* do what you want to do with ID here */
}
add_action( 'user_register', 'function_name');
2
The code you posted doesn't work because there is no global $currentpage.
There are $current_screen and $pagenow.
add_action( 'pre_get_posts', 'wpse_63414_hide_pages' );
function wpse_63414_hide_pages( $query ) {
if( !is_admin() )
return $query;
global $pagenow;
$pages = array('2','26');
if(
'edit.php' == $pagenow
...
1
Yes, this is the correct behavior, and no, there is nothing you can do about it in a multi-site setup. But that's usually not a problem; disk space is cheap.
Maybe you could run a workaround with a single-site installation and rewrite rules to map subdomains to URLs like /author/post-name/. But that sounds like a collsion magnet; so I wouldn't recommend it.
...
1
The two variables $name and $email are unknown inside the function. You have to make them globally available inside it by changing global $wpdb into global $wpdb, $name, $email:
require_once('../../../wp-load.php');
/**
* After t f's comment about putting global before the variable.
* Not necessary (http://php.net/manual/en/language.variables.scope.php)
...
1
Ok, first of all, I feel like an idiot, although in my defense most of the articles that talk about this don't mention a very crutial detail in making this work. The answer is that you need to set permission for at least one admin in the database. This info can be found in the Codex here: ...
1
The issue is that you are using an extremely unique configuration:
It is called Maya Shop. We are also using the Woo Commerce plug in for
the remaining e-commerce functions.
Two e-commerce platforms?
Considering the uniqueness and the fact that you already have a developer on this project:
This question is very unlikely to apply to anyone else.
...
1
Adding a BTREE or HASH index shouldn't break anything, and I imagine that is what you want. At worst you could end up with multiple indexes, or less than optimal ones, which might negatively effect performance. I assume that if you are going to do this you will be evaluating the change to see if it actually does help, rather than hurt.
I guess you could ...
1
Shortcodes don't need to take the form [shortcodename attribute="val1,val2"], they can also take the form [shortcode]stuff,stuff2,stuff3[/shortcode].
You could use a plugin that makes use of such shortcode, such as this:
http://wordpress.org/extend/plugins/easy-table/
Only top voted, non community-wiki answers of a minimum length are eligible