How to use plugins_url() inside PHP stylesheet file [duplicate]

Try background:url(<?php echo plugins_url().’/myimgfolder/my_img.png’; ?>) no-repeat <?php echo $x_position.’ ‘.$y_position; ?>; It will allow you to echo the PHP elements into your style. EDIT: You also need to close the file, you’re trying to mix unwrapped PHP with your CSS. Your PHP variables aren’t escaped either. I’ve tested the code below, and it works fine: … Read more

How do I use update_option to give me a new option name each time a form is submitted? [duplicate]

To update a new option name each time you need something unique to be used as option name so may be using ‘time’ in the option name $now = new DateTime(); $mytime = $now->format(‘Y-m-d H:i:s’); // MySQL datetime format // $now->getTimestamp(); // Unix Timestamp $option[‘prefix-‘.$mytime] = ‘your value’; Then you can update as you wish. … Read more

special XML to wordpress posts

turbo csv is a great plugin, i always use it on my projects : You convert your xml to csv (much easier to manage posts after) the plugin converts the csv to a post and you could even populate custom fields

wordpress plugins with add-ons

You could implement filters and actions in your core plugin’s code, at the appropriate places where you want your addons to interact, by using: do_action( ‘my_action’); apply_filters(‘my_filter’, $value, $variable_to_pass, $another_variable_to_pass); Then you can have addons as separate plugins and have them interact with the core via these hooks by calling: add_action(‘my_action’, ‘action_handle_function’); add_filter(‘my_filter’, ‘filter_handle_function’); this … Read more

single.php not pulling in any data from database

have_posts() needs a WordPress database query before it will show anything, check it here like this: $the_query = new WP_Query( ‘post_type=post’ ); if ( $the_query->have_posts() ) { echo ‘<ul>’; while ( $the_query->have_posts() ) { $the_query->the_post(); echo ‘<li>’ . get_the_title() . ‘</li>’; } echo ‘</ul>’; } else { // no posts found } it will display … Read more