Adding Dynamic Stylesheet

This is the recommended way to add a custom or second style sheet for child themes: function custom_style_sheet() { wp_enqueue_style( ‘custom-styling’, get_stylesheet_directory_uri() . ‘/css/custom.css’ ); } add_action(‘wp_enqueue_scripts’, ‘custom_style_sheet’); You can also add style sheets conditionally http://wpsites.net/wordpress-themes/second-style-sheet-theme/

Plugin option default value

There are two errors in your code. “echo’plugins_url( ‘/image/top.png’, __FILE__ )'” is not executed, it is just a string that happens to look like PHP code. What you really want is: $arr = array( “top_image”=> plugins_url( ‘/image/top.png’, __FILE__ ) ); Do not store default options in the database. Use the second parameter for get_option( $option, … Read more

Create an user on external database

No matter how you create a new user, it will end up calling wp_insert_user, which runs the action user_register right before finishing. So you can do something like the following: add_action(‘user_register’,’register_user_remotely’); function register_user_remotely($user_id) { //add user to external database $url = …; //url of file that will receive the $user->data in the $_POST variable $user … Read more

How to check homepage contain blog post?

In the case of expound theme index page is used as homepage, and there is no static front-page in the theme. Try to add is_home() to the condition. function addtoexcerpt($excerpt) { ob_start(); $values = ob_get_clean(); return $values.$excerpt; } if( is_single()||is_category()||is_home() ) { add_filter(‘the_excerpt’,’addtoexcerpt’); } I hope this should help you.

Modify a plugin function output from another plugin

I will never understand the point of these wildly complicated “helper” wrapper/plugins… but that aside… The plugin provides a lot of filters that might help you out. I think that the types_view filter might be what you want. Something like this is a plugin file or your theme functions.php might do it: add_filter(‘types_view’,’do_shortcode’); I do … Read more

Execute Jquery when a specific page in my plugin is loading

You’ll need to get the screen id on the screen (or page) in question using get_current_screen() get_current_screen()->id Then, hook into it with the following: function my_script_function() { if ( strpos( get_current_screen()->id, ‘screen_id’ ) !== false ) { wp_enqueue_script( ‘my_javascript_handle’, ‘path/to/my/script.js’, ‘jquery’, ‘1.0’ ); } } add_action( ‘admin_enqueue_scripts’, ‘my_script_function’ ); This will enqueue your script properly … Read more