Pass jquery var to a function in functions.php
Pass jquery var to a function in functions.php
Pass jquery var to a function in functions.php
admin-ajax.php nulls all php variables
Something like the following should work: function my_header() { ob_start(); include(get_template_directory() .’/file.php’; $content = ob_get_clean(); return $content; } add_shortcode(‘include’, ‘my_header’);
How about just echoing out the needed syntax like that: echo ‘<div class=”custom-field”>’ . genesis_get_custom_field(‘instrument’) . ‘</div>’; You can also just use CSS and style the header.entry-header { //your sexy styles goes here } Since other elements inside are wrapped in their own elements and styled separately (I mean the actual H1 and meta data) … Read more
Set thumbnail from URL, by grabbing image in functions.php
Is this even possible? If your description is correct and … The function is not pluggable, by which I assume you mean not wrapped in a if (!function_exists()) condition and The function is not a callback for an action or a filter and The function is not in a theme file that gets automatically substituted … Read more
The main issue with the code snippet is this line: function randomComment_handler($post_id) { Check out the Codex on add_shortcode() and see if you can find the error. Spoiler: It should be like this: function randomComment_handler( $atts, $content = NULL ) { ps: You should also avoid using extract(), use $atts[‘post_id’] instead. Further consider adding the … Read more
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
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
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