Translating form labels shortcode output

If anyone is looking for a solution, here is a way (probably not the better one) to achieve it: add_filter(‘widget_text’, ‘filtering_form_labels’); function filtering_form_labels($html) { if ( ICL_LANGUAGE_CODE==’en’ ) {/*ICL_LANGUAGE_CODE used in WPML to know the active language*/ $esp = array(‘Nombre’, ‘Apellidos’, ‘Suscribirse’); /*Array with words to be replaced*/ $eng = array(‘First Name’, ‘Last Name’, ‘Subscribe’); … Read more

I need to dynamic insert post containing javascript from my other website?

i think i found a solution function add_post($title, $content){ // Create post object wp_strip_all_tags if (!is_user_logged_in()){ $user_id = 1; wp_set_current_user($user_id,$user_login); wp_set_auth_cookie($user_id); do_action(‘wp_login’,$user_login); } $my_post = array( ‘post_title’ => $title, ‘post_content’ => $content, ‘post_name’ => sanitize_title($title), ‘post_status’ => ‘publish’, // ‘post_author’ => 1, ‘post_category’ => array(1) ); // Insert the post into the database wp_insert_post( $my_post … Read more

How to ‘If Author’ Comments Check

If you use the comment_class function to add classes to each comment, comments by the post’s author can be styled via the bypostauthor class. You can alternately match the comment ID against the post ID: global $post; if( $comment->user_id === $post->post_author ) { // is author comment }

Display metabox with date

In database, it stores the date details with prefix as _start and _end so you need to change the meta keys accordingly. Please have a look at the below code. <p>Start time details</p> <p>Date: <?php echo get_post_meta($post->ID, ‘_start_day’, true);?>.<?php echo get_post_meta($post->ID, ‘_start_month’, true);?>.<?php echo get_post_meta($post->ID, ‘_start_year’, true);?></p> <p>Hour: <?php echo get_post_meta($post->ID, ‘_start_hour’, true);?>:<?php echo get_post_meta($post->ID, … Read more

get_posts and wp_autop (remove filter)

You could make your own excerpt function: function wpse125086_custom_strip_tags_excerpt() { global $post; $p_obj = get_post($post->ID); $p_exp = $p_obj->post_excerpt; $p_exp = apply_filters(‘the_excerpt’, $p_exp); $un_p = array(“<p>”, “</p>”); $p_exp = str_replace($un_p, “”, $p_exp); echo $pcont; } But generally I’m thinking instead of transforming to get_posts() it might be better to go with WP_Query. In this case the … Read more

WordPress nested loop not working

Have you checked slug of ‘graphic-design’ CPT?. Maybe there are conflicts between page slug and CPT slug? You can’t really do what you are trying to do in the way you would like to do it. /graphic-design/ is registered with the custom post type as the custom post type permalink associated with that custom post … Read more

How to set a link to custom archieve page

I am working on my blog where I wish to have a archieve for only specific category post. If I understand you, you are doing this wrong. What you want to do is use pre_get_posts to restrict your archives to the one category. Something like this: function restrict_archives_to_cat($qry) { if ($qry->is_main_query() && $qry->is_date()) { $qry->set(‘cat’,5); … Read more