remove from text-widget

OK, attempting to remove the with jQuery is counter intuitive. Modifying it via output buffering is inefficient. And we shouldn’t edit the actual widget code itself, since this will revert back next time we update WordPress. I would suggest either creating your own text widget, or simply extend and modify the existing WordPress widget as … Read more

Load post with a different template?

you can do it like this: //add my_print to query vars function add_print_query_vars($vars) { // add my_print to the valid list of variables $new_vars = array(‘my_print’); $vars = $new_vars + $vars; return $vars; } add_filter(‘query_vars’, ‘add_print_query_vars’); then add a template redirect based on that query_var: add_action(“template_redirect”, ‘my_template_redirect_2322’); // Template selection function my_template_redirect_2322() { global $wp; … Read more

Automatically decrease font size for long words

I’ve done something similar taking the simple approach of adding a CSS class to titles based on their character count. That CSS class then decreases letter-spacing and/or font-size. // Count the characters, taking Unicode into account $chars = mb_strlen($post->post_title); // For every 10 characters after the first 20, add a size $size = max(0, ceil(($chars … Read more

How to keep   non-breaking spaces in the visual editor?

This seems to do it: function allow_nbsp_in_tinymce( $mceInit ) { $mceInit[‘entities’] = ‘160,nbsp,38,amp,60,lt,62,gt’; $mceInit[‘entity_encoding’] = ‘named’; return $mceInit; } add_filter( ‘tiny_mce_before_init’, ‘allow_nbsp_in_tinymce’ ); Also see: https://www.tinymce.com/docs/configure/content-filtering/#entities Any improvement suggestions?

How can I input a single right-to-left paragraph (Hebrew) into an English page/post?

You can add a hebrew shortcode to wrap around your hebrew text and then use the CSS2 direction attribute to indicate the text direction. e.g.: In your themes functions.php: function hebrew_shortcode( $atts, $content = null ) { return ‘<p lang=”he” DIR=”RTL”>’ . $content . ‘</p>’; } add_shortcode( ‘hebrew’, ‘hebrew_shortcode’ ); Your content: [hebrew]Hebrew styled right … Read more

Problem in wordpress with “-“

Background: WordPress converts normal dash (-) to long dash (–), straight quotes to curly quotes and some other similar symbols and punctuations to their printer friendly versions using wptexturize. Generally it’s recommended to leave them up to WordPress. However, occasionally, we may want to override this behaviour. For example, in case we are writing Programming … Read more

Export all posts as individual plain txt files

Try this (you may need to bootstrap WP by loading wp-load.php, depending on where you put this code). $args = array( ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, //’posts_per_page’ => -1 //uncomment this to get all posts ); $query = new WP_Query($args); while ( $query->have_posts() ) : $query->the_post(); $f = fopen(get_the_title() . ‘.txt’, ‘w’); $content=”Title: ” … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)