Xml output not places where i want

Shortcodes must return content and not echo it. See any of the examples in the codex for add_shortcode() So your callback function should probably be: function CheckRemoteService($atts) { extract(shortcode_atts(array( ‘name’ => ‘txt’, ), $atts)); $xml = simplexml_load_file(‘my.xml’); return $xml->sites->$name; } add_shortcode(‘checkmyurl’,’CheckRemoteService’);

Cron job to call php to email last 24 hours posts

In your functions.php you can use this. You will have to activate your theme again for it to take effect. You only want to schedule a cron job on activation, not on activation NOT on every page load, which is what the functions.php does, it loads on every page load. This would be betterused in … Read more

private functions in plugins

Well, it is not possible, I guess. If you define function in global scope, then it is visible for all code. The only way to make it private for plugin is to use OOP (and it’s recommended way of writing plugins). You can rename this function, but it won’t solve your problem in the long … Read more

!in_array doesnt recognize category

Try it like this: if ( $query->have_posts() ) { $categories = $category_ids = array(); while ( $query->have_posts() ) { $query->the_post(); foreach ( ( get_the_category() ) as $category ) { if ( ! in_array( $category->term_id, $category_ids ) ) { $category_ids[] = $category->term_id; $categories[] = $category; } } }; } get_the_category() returns an array of objects. I … Read more

Show message if statement is false – foreach

OK, it’s a lot of guessing, because I can’t see the rest of your code, but something like this should work, I hope… <?php $value = get_post_custom_values(“kpm_UploadFile”); $url = ($value[0]); $tokens = explode(“https://wordpress.stackexchange.com/”, $url); $dlvalue = $tokens[sizeof($tokens)-1]; if (current_user_can(‘read’)) { $found = 0; foreach ($files_array as $key => $val) { if ($dlvalue == $val) { … Read more

How to export database correctly for local to online

What Options are you changing after upload to production server? I think after upload .sql file your website don’t want appear in browser? Check it: After import your local .sql file to production server, log in to production/phpmyadmin website, go to wp_options and check values: | option_id | option_name | option_value | —————————————— | id=1 … Read more

Get first comment link on the post itself

you can get comment link by wp function $args = array( ‘number’ => ‘1’, ‘post_id’ => your_post_id, // use post_id, not post_ID ); $comments = get_comments($args); <a href=”https://wordpress.stackexchange.com/questions/108654/<?php echo get_comment_link( $comments->comment_ID ); ?>”>postname</a>

Hide a div from a particular page and single pages in WordPress

Just change this: <?php if( is_page() ) { ?> to: <?php if( is_page() && !is_page(42) ) { ?> You can also try to use is_home() and is_front_page(). These 2 will be even better, since they are more universal (not based on pageId). If you change the page that is your home/front page, this will still … Read more