Selectbox in admin panel function linking to CSS

Not Recommended <?php if(theme_get_option(‘theme_style_options’) == ‘style1’): ?> <link rel=”stylesheet” type=”text/css” media=”all” href=”https://wordpress.stackexchange.com/questions/55754/<?php echo get_template_directory_uri(); ?>/style1.css” /> <?php elseif(theme_get_option(‘theme_style_options’) == ‘style2’): ?> <link rel=”stylesheet” type=”text/css” media=”all” href=”<?php echo get_template_directory_uri(); ?>/style2.css” /> <?php elseif(theme_get_option(‘theme_style_options’) == ‘style3’): ?> <link rel=”stylesheet” type=”text/css” media=”all” href=”<?php echo get_template_directory_uri(); ?>/style3.css” /> <?php endif;?> OR <link rel=”stylesheet” type=”text/css” media=”all” href=”https://wordpress.stackexchange.com/questions/55754/<?php echo get_template_directory_uri(); ?>/<?php … Read more

Loop with slider (slider not loading)

The simplest explanation is that the HTML rendered in your code does not match what you’re actually looking for. Without seeing the JS responsible for the slider, it’s impossible to say where you went wrong, but you should compare the mocked-up version (that works) with what you’re actually getting (HTML source after page render) to … Read more

Where to put snarfer.php?

Yes, templates files belong to a theme and therefore into the theme directory. The Codex text is a bit vague currently. You should edit that until it is easy to understand. 🙂

How can I randomize a Nextgen Gallery Slideshow [closed]

There’s a function defined in nggfunctions.php that you can use directly in the template page: /* nggShowRandomRecent($type, $maxImages, $template, $galleryId) – return recent or random images * * @access public * @param string $type ‘id’ (for latest addition to DB), ‘date’ (for image with the latest date), ‘sort’ (for image sorted by user order) or … Read more

mysql query from wordpress page using custom table

I think if you add a couple of periods before and after the php variable in your query, remove the use of mysql_fetch_array, and use get_row(), it should work better. Here’s how I would get a park from your custom table: <?php $page_title = wp_title(”); $park = $wpdb->get_row(“SELECT * FROM $wpdb->park_data WHERE park_name=””.$page_title.”””); if($park) { … Read more

Logged in user ID as post ID

You can get information on the currently logged in user using the get_currentuserinfo() function. For example: <?php global $current_user; get_currentuserinfo(); $username = $current_user->user_login; $user_id = $current_user->ID; ?> You can then use $username or $user_id in your custom loop. <?php // assign the variable as current category $category = $user_id; // concatenate the query $args=”cat=” . … Read more

custom fields wordpress

The update_user_meta and get_user_meta functions are what you want, without having to fool around with any database connections or SQL. All it takes is one include statement in your theme, and a bit of PHP magic to call the meta functions. Check out my code, which accomplished what you are trying to do, on Github … Read more

How to add a php custom page to WordPress

Please refer to the Page Templates section of the Static Pages Codex entry. Essentially, you create a custom page template, named something like template-foobar.php, which will live in your Theme’s root directory, or in a one-deep sub-directory. Inside this template file, add the following: <?php /** * Template Name: Foobar */ get_header(); // YOUR CUSTOM … Read more