Can you keep session data for visitors?

I would recommend using $_GET or $_POST variables … the same way you submit the form. This has nothing to do with session. Basically, when the user fills out the form, you’re populating $_POST with information. When the user submits the form, you process the information in $_POST and display a thank you page … … Read more

Using $themename Variables

You can do it easier and without polluting the global namespace: get_option(‘template’); gives you the (parent) themes name. If you want the child themes name, use get_current_theme();. You could also use a constant across your theme files: define( ‘YOUR_PREFIX-THEME_NAME’, get_current_theme() );

Echoing a variable inside a function

Use the Settings API. A look at my latest plugin may help you to understand how to register a save function for your fields. Most relevant excerpt: /** * Register custom settings for the fields. * * @see save_settings() * @see print_input_field() * @return void */ public function add_contact_fields() { register_setting( ‘general’, $this->option_name, array ( … Read more

Use to track referrals

Try using add_query_arg(). For example, if your query key is “ref”, and your query key value is “AFFILIATEID”: <?php add_query_arg( ‘ref’, ‘AFFILIATEID’ ); ?> If you need to retrieve your query arg value, use get_query_var(): <?php get_query_var( ‘ref’ ); ?>

How can I Add a variable PHP in the Menu Nav

You should never need a plugin to insert raw PHP code somewhere. There are always side effects you cannot see or fix easily. Filter wp_nav_menu_objects instead, and add the parameter here to the URLs. if ( ! empty ( $_GET[‘partenaire’] ) ) add_filter( ‘wp_nav_menu_objects’, ‘wpse_82194_add_param’ ); /** * Add a parameter to item URLs. * … Read more

How do i calculate the total of values of custom fields in custom post types?

It’s a matter of keeping a running total. Because I’m not 100% clear on the question, below I am providing the changes / pseudo-code for what you want to do: <?php if ( is_user_logged_in() ): global $current_user; get_currentuserinfo(); // ADDED: Initialize the total variable to prevent warnings $grandtotal = 0; $author_query = array(‘posts_per_page’ => ‘-1′,’author’ … Read more