Conditionally write open graph meta property in header

From what I understand, you need help framing your if logic? And the php tags usage dont look right either. Does this help – <?php if(!is_single()){ if(is_home() || is_front_page()){ // not sure if you have set a static page as your front page echo ‘<meta property=”og:url” content=”‘.bloginfo(‘url’); .'” />’; }elseif(is_tag()){ echo ‘<meta property=”og:url” content=”‘.$_SERVER[“HTTP_HOST”] . … Read more

theme options not saving

Your register_setting() should be for all fields like below function register_mysettings() { //register our settings register_setting( ‘theme-settings-group’, ‘facebook’ ); register_setting( ‘theme-settings-group’, ‘twitter’ ); register_setting( ‘theme-settings-group’, ‘pinterest’ ); register_setting( ‘theme-settings-group’, ‘googleplus’ ); //etc } Do this for all fields and let me know if you stuck at anything

Add gallery id to rel attribe of wp_get_attachment_link

That filter passes more arguments than you are using. return apply_filters( ‘wp_get_attachment_link”https://wordpress.stackexchange.com/questions/134811/,”<a href=”https://wordpress.stackexchange.com/questions/134811/$url”>$link_text</a>”, $id, $size, $permalink, $icon, $text ); The second of those is the one you need. So you need to alter you callback to use the second parameter, and alter your add_filter to ask for it by setting the fourth argument to 2. … Read more

Modify function Shortcode_atts

You are misusing shortcode_atts(). You need to pass the shortcode an array of defaults in the first argument, which you have done. Then you need to pass the user supplied arguments in the second argument, which you haven’t done. Your shortcode callback uses $params yet for some reason you are passing $atts, which is not … Read more

Override default password nag in WordPress

The function is hooked to an action, so you should be able to remove it. remove_action(‘admin_notices’,’default_password_nag’); You can then add back a function of your own choosing. Rename your function to something that won’t conflict with the Core function name and… add_action(‘admin_notices’,’my_password_nag’); You will need to create a plugin or mu-plugin to do it, but … Read more

A blank page is shown after I add a Function

Have you tried this: <?php add_action( ‘template_redirect’, ‘wp138320_template_redirect’ ); function wp138320_template_redirect() { if ( ! current_user_can( ‘manage_options’ ) ) { include( get_template_directory() . ‘/holding.php’ ); exit; } } ?> I’m currently working on a site that has issues with hooking into actions/filters like that too, changing it to something like the code above did the … Read more