Thumbnail + Excerpt = loss in word count

For everybody that is looking for a great excerpt that keep html tags in tact and want the excerpt not to cut off mid sentence and have a true word count, here is the code function pietergoosen_custom_wp_trim_excerpt($text) { global $post; $raw_excerpt = $text; if ( ” == $text ) { $text = get_the_content(”); $text = … Read more

How to edit plugin’s html? [closed]

You should have the option to edit any plugin’s code from the plugins screen. Under the name of each plugin you should see an Edit link which gives you access to the plugin code. Any changes that you make to the plugin will be completely wiped out when the plugin updates unless you ensure that … Read more

Remove Line Breaks From Cell Content in WordPress

The <br/> tags are added by wpautop function that is hooked into the_content filter. So you need to unhook it from the page where your table is displayed. There are several ways to do this. With PHP you can do something like this (change the ‘your_page/post_id’ with the actual ID) function wpdg_91929_remove_autop_for_page( $content ) { … Read more

Two posts in same div – WP loop

This is really just a matter of logic. You need to conditionally print the div markup. The counter in $wp_query will let you chose every second post. if (have_posts()) { echo ‘<div class=”posts-wrapped”>’; while (have_posts()) { the_post(); if (0 !== $wp_query->current_post && 0 === $wp_query->current_post%2 ) { echo $wp_query->current_post.'</div><div class=”posts-wrapped”>’; } the_title(); echo ‘<br />’; … Read more

customize comment form

This code will allow you to customize the comment field labels and will move the comment form below the fields. Add the code to your functions.php or to a plugin. To change the labels, modify the Name CUSTOMIZED, Email CUSTOMIZED, and Website CUSTOMIZED, and Comment * CUSTOMIZED text. /** * Customize comment form default fields. … Read more

How do I make wordpress comment fields required?

First of all, I highly recommend using the comment_form() function. It’s all of the above code in one line (more if you need to tweak parts of the code). You can designate name and email as required in the settings section of your admin area:

Localizing a string with html tag with word inside that tag

Possible solution to get everything translatable as one sting. <?php printf(__(‘Click <a href=”https://wordpress.stackexchange.com/questions/135866/%s”>Here</a> to go and wacth the video.’, ‘pietergoosen’), esc_url( get_permalink() )); ?> It is usually safe to assume that the translator have enough knowledge of HTML to understand what is going on there.

alt, title tags not showing

It actually depends upon how the image is shown in the template. If it is shown using a function like the_post_thumbnail() which returns complete html string to show image with alt then there should be no problem but if image is shown by only fetching URL then it depends how it is displayed . For … Read more