Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
6

The short description template is /templates/single-product/short-description.php : <?php /** * Single product short description * * @author WooThemes * @package WooCommerce/Templates * @version 1.6.4 */ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly global $post; if ( ! $post->post_excerpt ) return; ?> <...


6

When no hook is available, you can always count on the old jQuery trickery... add_action( 'admin_footer-edit-tags.php', 'wpse_56569_remove_cat_tag_description' ); function wpse_56569_remove_cat_tag_description(){ global $current_screen; switch ( $current_screen->id ) { case 'edit-category': // WE ARE AT /wp-admin/edit-...


5

Apply wpautop - it converts line breaks into <br /> and double breaks into paragraphs. echo wpautop( wptexturize( get_yoast_term_description() ) );


5

If we look at the source of wp_insert_attachment() we find the hooks edit_attachment and add_attachment. In your case we could use the add_attachment hook. The callback takes the attachment's ID as a parameter. By looking at the database table wp_posts we see that the description is saved as post_content and the caption as post_excerpt: Then you could try ...


5

The filter views_{$this->screen->id} is fired just after the title of post edit screen has been print to screen, so it's a safe place to just echo what you want. So you can simply do: function post_type_desc( $views ){ $screen = get_current_screen(); $post_type = get_post_type_object($screen->post_type); if ($post_type->...


4

Use CSS, I was implementing the JS solution and I didn't like the delay, then I've remembered about this. body.taxonomy-name .term-description-wrap { display:none; }


4

The object returned by get_tags() should have a description property, so you don't need to try to get it again. Just check to be sure $tags->description isn't empty. You should probably also reorganize so that you don't do anything at all unless if($tags). Thus: // Get ALL the tags! $tags = get_tags( array( 'hide_empty' => false ) ); if ($tags) { ...


4

The meta description isn't part of the Twenty Fifteen theme. You mentioned the Yoast plugin in a previous question yesterday, so I guess the meta description comes from there. According to their API page, there's a filter called wpseo_metadesc that might be what you're looking for. Here's an untested example: /** * Change the Yoast meta description for ...


3

The HTML is stripped by wp_filter_kses(). So this should work: remove_filter( 'pre_term_description', 'wp_filter_kses' ); When you want to print that content, use wpautop(): echo wpautop( term_description() );


3

By using wp_update_post(), found in wp-includes/post.php: // Update post 42 $post = array(); $post['ID'] = 42; $post['post_category'] = array( ... ); $post['post_content' ] = 'This is the updated content.'; $post['post_title' ] = 'This is the updated title.'; // Update the post into the database wp_update_post( $post );


3

Ok. I've found a solution. Thanks to this great article on Smashing Magazine The code to retrieve category description from any taxonomy term would be : <?php echo (get_term_by('slug', 'your-term-name', 'your-taxonomy-name')->description); ?> As simple as that


3

This part comes from the function comment_form() which is called by your theme, probably in comments.php: 'comment_notes_after' => '<p class="form-allowed-tags">' . sprintf( __( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s' ), ' <code>' . allowed_tags() . '</code&...


3

<?php // grab description, // note the "get_", we're not echoing the author meta, we're returning it $user_description = get_the_author_meta('description'); // removing all HTML tags: echo strip_tags($user_description); // removing all tags apart from paragraphs: echo strip_tags($user_description,'<p>'); // removing ...


3

You can make use of wp_get_current_user() or get_currentuserinfo() (to which wp_get_current_user() is a wrapper function to) or get_current_user_id() which uses wp_get_current_user() to get the current logged in user ID. One way or the other, you need to make sure that you have a logged in user (user ID is not 0) before trying to get the user's metadata ...


3

There is not a standerized way to add HTML meta tags in WordPress but you can use wp_head action as a generic way to add meta tags. I think description meta tag should not be in the theme, as you suggest in your answer, because description meta tag is a property of the document, nothing to do with the look and feel of the document, that is, the theme. This ...


3

There's a wpseo_title filter you can hook into. Example: add_filter('wpseo_title', 'add_to_page_titles'); function add_to_page_titles($title) { $title .= $addToTitle; return $title; }


3

OK, it took me a little while to debug this behaviour, but... Everything is clear for me right now... I'm not sure if this is fully intentional... Why is it so? So... The line breaks are stored in DB correctly. Then in wp_setup_nav_menu_item the description field is filled based on post_content column of given menu item post. On line 845 (https://core....


2

I just inatalled it and used the Custom menus and i get no description Never the less.. This theme have a "disable description in Header Menu" feature. On Your wordpress menu go to: Graphene Options >> Display >> Navigation Menu Display Options.. Click the "disable description in Header Menu" And your done..


2

AFAIK, you can add new fields but you cannot remove the old ones! They are directly printed, and not stored in a variable to which a filter can be applied. Ref: wp-admin/edit-tags.php, line no. 380.


2

You can use pre_user_description hook, which filters the user's description prior to saving/updating the user, to remove any unwanted tags. To do that, you can use the wp_kses function, which strips out all but whitelisted tags. The allowed tags should be given as an associative array, where the keys are the names of the tags, and the values are an array ...


2

I was having the same problem the other day, due to a completely different typo ;) $args = array( 'description' =>"My Desc", 'slug' => "My Slug", 'parent' => 0 ); $result = wp_insert_term("Term1", "category", $args); Note the corrected 'description' element in the $args array.


2

Ok I had to write my own custom excerpt like such: function custom_excerpt($text = '') { $raw_excerpt = $text; if ( '' == $text ) { $text = get_the_content(''); // $text = strip_shortcodes( $text ); $text = do_shortcode( $text ); $text = apply_filters('the_content', $text); $text = str_replace(']]>',...


2

I don't understand your attempt to use PHP_Exec, especially by embedding it in the content section of the page. That is going to run much too late to alter anything in the <head> of the document. Here is the problem you are facing, starting from what looks to be your primary question: So what I need to do is understanding how Wordpress is adding ...


2

Image data is stored as if it were a post, or a CPT, so you can treat it like one. $album_id = get_the_id(); $img = new WP_Query(array('p'=>$album_id,'post_type'=>'attachment')); var_dump($img->posts[0]->post_content); Or, a little more complicated,... $album_id = get_the_id(); $img = new WP_Query(array('p'=>$album_id,'post_type'=>'...


2

There are two conditionals, depending on your setup: is_home() - checks if the main page is being displayed is_front_page() - returns TRUE when the main blog page is being displayed and the Settings->Reading->Front page displays is set to "Your latest posts", or when is set to "A static page" and the "Front Page" value is the current Page being ...


2

The "Reading Settings" at a domain's wp-admin/options-reading.php is, by default, set to latest posts. So, WordPress, by default, would show the title of the post being set at "General Settings" at a domain's wp-admin/options-general.php . In this case, Yoast's WordPress SEO plugin would have form fields to customize it. When the "Reading Settings" are ...


2

WordPress stores image (attachment) data as follows: Description: post_content field Caption: post_excerpt field Alt: _wp_attachment_image_alt meta value And in code, that translates to: // Description echo $post->post_content; // Raw the_content(); // Caption (description as fallback) the_excerpt(); // Caption (explicitly) echo $post->...


2

Using DOMDocument and DOMXPath you could try this. <?php while (have_posts()) : the_post(); ob_start(); // run the_content() through the Output Buffer the_content(); $html = ob_get_clean(); // Store the formatted HTML $content = new DomDocument(); // Create a new DOMDocument Object to work with our HTML $content->loadHTML( $html ); // Load the $html ...


2

The more proper API way would be using term_description() template tag. It's same in principle as accessing property, but with proper filters and stuff. Since term lists are usually focused on names, I can't anything that would iterate and list descriptions in one step.


2

You need to get the metadata of each image, add this to your functions.php file: function get_post_gallery_images_with_info($postvar = NULL) { if(!isset($postvar)){ global $post; $postvar = $post;//if the param wasnt sent } $post_content = $postvar->post_content; preg_match('/\[gallery.*ids=.(.*).\]/', $post_content, $ids)...


Only top voted, non community-wiki answers of a minimum length are eligible