Assigning WP functions which echo to PHP variables
Found it, I think this was suggested to me in another answer. $output .= … ob_start(); settings_fields(‘my_settings’); do_settings_sections(‘my_settings’); $output .= ob_get_clean();
Found it, I think this was suggested to me in another answer. $output .= … ob_start(); settings_fields(‘my_settings’); do_settings_sections(‘my_settings’); $output .= ob_get_clean();
As it happens, I have something very similar on one of my sites to to allow Administrators update some custom user meta. Basically, you need to add an additional column and then populate it with a link to do what you want. When you click the link some jQuery fires of an AJAX request to … Read more
Your plugin inserts its feelbox widget by filtering the_content: if ($options[‘showinpostsondefault’] == ‘on’) { add_filter(‘the_content’, ‘add_feelbox_widget_to_posts’); } But your index page doesn’t display the_content, just Title, featured thumbnail, an excerpt and, number of comments. The plugin code you’ve shown us doesn’t include a print_feelbox_widget() function. Does such a function actually exist in your plugin? (Also, … Read more
You have a problem with your code formatting and syntax at the very least: function ref_access(){ global $error; if (is_user_logged_in()) // <– problem here… $newdb = new wpdb( ‘user’, ‘pass’, ‘db’, ‘localhost’ ); global $newdb; $hf_username = wp_get_current_user(); $inputValue = $_POST[$quanid]; $wpdb->insert( $table, array( ‘ItemID’ => $quanid ‘Price’ => $inputValue ‘user’ => $hf_username ), ); … Read more
Lets start with your first code. If you add texts, captions etc. a shortcode will be generated: The function img_caption_shortcode() in wp-content/media.php is responsible to execute the shortcode. But this shortcode is only produced, when you use captions. Otherwise, it will be simply inserted the <a>– and <img>-Tag. who decides, what gets inserted? There is … Read more
It was simpler than I thought. This has solved it. <?php add_filter(‘the_content_more_link’, ‘modify_read_more_link’); function modify_read_more_link() { return ‘<a class=”more-link” href=”‘ . get_permalink() . ‘”>Your Read More Link Text</a>’; } the_content(“Read More”); ?>
You could use get_attached_media() function to check if the post has any attached images to it. Also, you use wrong logic operator. Your code would look like this: $attached_images = get_attached_media(‘image’, $post->ID); if ( (get_the_post_thumbnail() == NULL) && empty($attached_images) ) { // show your default image } else { // do nothing, I guess? }
See WordPress Template Hierarchy and figure out which page you’ve to modify. From this figure, it’s easy to see that if you want to modify your homepage, you have to modify frong-page.php. It it doesn’t exist, check if a custom page template is used to serve the home page and edit that page template. If … Read more
you can just check for the customize object, but if you absolutely need a conditional statement to determine whatever it is you need, you can do something like this: jQuery( function( $ ) { // set var var in_customizer = false; // check for wp.customize return boolean if ( typeof wp !== ‘undefined’ ) { … Read more
I don’t suspect that your tax_query is failing you, but actually your tag parameter is. single_tag_title() returns the name of the tag, not the slug. All tag and category queries are converted to a tax_query in the WP_Query class before being passed to the WP_Tax_Query class to build the relative string for the SQL query. … Read more