Forum Replies Created

Viewing 15 replies - 16 through 30 (of 40 total)
  • Thread Starter aosipov

    (@aosipov)

    this is my query, can i somehow to make it look like a global query? i guess this is what Yoast want:)

    <?php
    /**
     *  Template Name: Archive Page Custom
     *
     * @link https://codex.www.ads-software.com/Template_Hierarchy
     *
     * @package ifood-theme
     */
    
    get_header(); ?>
    
    <div id="primary" class="content-area blog-archive col-md-9">
      <main id="main" class="site-main">
        <h1 class="display page-title">Blog</h1>
        <?php query_posts('post_type=post&post_status=publish&posts_per_page=24&paged='. get_query_var('paged')); ?>
    	   <?php if( have_posts() ): ?>
          <div class="row">
            <?php while( have_posts() ): the_post(); ?>
              <article id="post-<?php the_ID(); ?>" <?php post_class('col-md-4'); ?>>
                <?php if ( has_post_thumbnail() ) : ?>
                  <a class="post-teaser" href="<?php the_permalink() ?>" title="<?php the_title(); ?>">
                    <div class="thumbnail-block"><?php the_post_thumbnail('regular-post-thumbnail'); ?></div>
                    <div class="title-block"><span class="h3 title-for-widget"><?php the_title(); ?></span></div>
                  </a>
                <?php endif; ?>
              </article>
            <?php endwhile; ?>
          </div>
          <div class="pagination-block row">
    		      <?php numeric_posts_nav(); ?>
          </div>
    	     <?php else: ?>
          <div id="post-404" class="noposts">
      		    <p><?php _e('None found.','example'); ?></p>
      	  </div><!-- /#post-404 -->
    	 <?php endif; wp_reset_query(); ?>
      </main>
    </div>
    <?php
    get_sidebar('archive');
    get_footer();
    
    Thread Starter aosipov

    (@aosipov)

    Hi there, thanks for the replying.:)
    * I have a pretty good server (i will clarify today)
    * Don’t have any email or notification plugins enabled
    only related to this i have Post SMTP, Email Log, WooCommerce – MailerLite.
    Tell me maybe some of them has an effect?
    * I have only 81 active subscribers.

    Thanks
    Alex

    Thread Starter aosipov

    (@aosipov)

    hey @bcworkz that worked amazingly! You are genius:)
    Thank you so much.
    Next step i was thinking if i can make them clickable LOL, or maybe this is for another time!:))
    Have a great weekend!

    Thread Starter aosipov

    (@aosipov)

    hey @bcworkz
    this is works:

    function new_modify_user_table( $column ) {
        $column['id'] = 'ID';
    	$column['favorites_number'] = 'Favorites Number';
    	$column['favorites_posts'] = 'Favorites Posts';
        return $column;
    }
    add_filter( 'manage_users_columns', 'new_modify_user_table' );
    
    function new_modify_user_table_row( $val, $column_name, $user_id ) {
        switch ($column_name) {
    case 'id' :
        return get_the_author_meta( 'ID', $user_id );
    case 'favorites_number' :
        $faves = get_the_author_meta('simplefavorites', $user_id);
        return count( $faves[0]['posts']);
    case 'favorites_posts' :
        $faves = get_the_author_meta('simplefavorites', $user_id);
    	return implode(', ', $faves[0]['posts']);
    
            default:
        }
        return $val;
    }
    add_filter( 'manage_users_custom_column', 'new_modify_user_table_row', 10, 3 );

    in one column it displays the number of saved posts, in another display array: 44212, 35940, 43810, 32773, 58370, 43843, 53505, 50357… like this

    The only thing that is not working is in first column “favorites_number” it displays 1 when there are no posts selected

    Thank you so much for your help!

    Thread Starter aosipov

    (@aosipov)

    heeeey i did this
    return count( $faves[0]['posts']);
    this works, Thank you!!!!! displays number 1 though when is there is empty array, but thats ok:)

    Now i am wondering if i can display the IDs of the posts in next column, so to display list of those posts IDs.
    This is what i have so far:

    function new_modify_user_table( $column ) {
        $column['id'] = 'ID';
    	$column['favorites_number'] = 'Favorites Number';
    	$column['favorites_posts'] = 'Favorites Posts';
        return $column;
    }
    add_filter( 'manage_users_columns', 'new_modify_user_table' );
    
    function new_modify_user_table_row( $val, $column_name, $user_id ) {
        switch ($column_name) {
    case 'id' :
        return get_the_author_meta( 'ID', $user_id );
    case 'favorites_number' :
        $faves = get_the_author_meta('simplefavorites', $user_id);
        return count( $faves[0]['posts']);
    case 'favorites_posts' :
        $faves = get_the_author_meta('simplefavorites', $user_id);
        return print_r( $faves[0], true);
            default:
        }
        return $val;
    }
    add_filter( 'manage_users_custom_column', 'new_modify_user_table_row', 10, 3 );

    Thanks
    A

    Thread Starter aosipov

    (@aosipov)

    Well first one did not work, but when you remove [0]
    return print_r($faves[0], true);
    i’ve got output like this:

    <td class="favorites column-favorites" data-colname="Favorites">Array
    (
        [site_id] => 1
        [posts] => Array
            (
                [0] => 35665
            )
    
        [groups] => Array
            (
                [0] => Array
                    (
                        [group_id] => 1
                        [site_id] => 1
                        [group_name] => Default List
                        [posts] => Array
                            (
                                [0] => 35665
                            )
    
                    )
    
            )
    
    )
    </td>

    basically this is the text that outputs in the table cell:
    Array ( [site_id] => 1 [posts] => Array ( [0] => 35665 ) [groups] => Array ( [0] => Array ( [group_id] => 1 [site_id] => 1 [group_name] => Default List [posts] => Array ( [0] => 35665 ) ) ) )

    A

    Thread Starter aosipov

    (@aosipov)

    Hi @bcworkz when i use this line return count( $faves[0][0]['posts']);
    my output for user who has simplefavorites is <td class="favorites column-favorites" data-colname="Favorites">0</td>
    User who doesnt have <td class="favorites column-favorites" data-colname="Favorites">1</td>
    When i replace with this line return print_r($faves[0][0]['posts'], true);
    All output is empty.:(
    <td class="favorites column-favorites" data-colname="Favorites"></td>

    Thread Starter aosipov

    (@aosipov)

    yeey thank you, its working, but it shows 1 or 0, not a number of posts.
    This is the code:

    function new_modify_user_table( $column ) {
        $column['id'] = 'ID';
    	$column['favorites'] = 'Favorites';
        return $column;
    }
    add_filter( 'manage_users_columns', 'new_modify_user_table' );
    
    function new_modify_user_table_row( $val, $column_name, $user_id ) {
        switch ($column_name) {
            case 'id' :
                return get_the_author_meta( 'ID', $user_id );
     case 'favorites' :
        $faves = get_the_author_meta('simplefavorites', $user_id);
        return count( $faves[0][0]['posts']);
            default:
        }
        return $val;
    }
    add_filter( 'manage_users_custom_column', 'new_modify_user_table_row', 10, 3 );
    Thread Starter aosipov

    (@aosipov)

    ?? doesn’t work, displays “Array”

    Thread Starter aosipov

    (@aosipov)

    I think i am doing something wrong here LOL:

    function new_modify_user_table( $column ) {
        $column['id'] = 'ID';
    	$column['favorites'] = 'Favorites';
        return $column;
    }
    add_filter( 'manage_users_columns', 'new_modify_user_table' );
    
    function new_modify_user_table_row( $val, $column_name, $user_id ) {
        switch ($column_name) {
            case 'id' :
                return get_the_author_meta( 'ID', $user_id );
    	    case 'favorites' :
                return get_the_author_meta('simplefavorites', $user_id);
    			$faves = array('simplefavorites' => array('posts'));
    			echo count( $faves[0][0]['posts']);
            default:
        }
        return $val;
    }
    add_filter( 'manage_users_custom_column', 'new_modify_user_table_row', 10, 3 );
    Thread Starter aosipov

    (@aosipov)

    Hey bcworkz, how do i modify my existing function?

    function new_modify_user_table( $column ) {
        $column['id'] = 'ID';
    	$column['favorites'] = 'Favorites';
        return $column;
    }
    add_filter( 'manage_users_columns', 'new_modify_user_table' );
    
    function new_modify_user_table_row( $val, $column_name, $user_id ) {
        switch ($column_name) {
            case 'id' :
                return get_the_author_meta( 'ID', $user_id );
    	    case 'favorites' :
                return get_the_author_meta('simplefavorites', $faves);
    			echo count( $faves[0][0]['posts']);
    			var_dump($posts);
            default:
        }
        return $val;
    }
    add_filter( 'manage_users_custom_column', 'new_modify_user_table_row', 10, 3 );
    
    Thread Starter aosipov

    (@aosipov)

    No this is actually WooCommerce Membership Plugin, i submitted ticket to them, but i am just wondering if anyone else had to deal with the same? Or knows more about hooks and cron than me:)

    Thanks
    Alex

    • This reply was modified 4 years, 11 months ago by aosipov.
    Thread Starter aosipov

    (@aosipov)

    Hi Con , yes i did this but you guys claiming “We’re anticipating that our availability in chat the next few days may be lower than normal” i am not sure how long it will take.

    Thanks:)

    Forum: Fixing WordPress
    In reply to: Pinterest error
    Thread Starter aosipov

    (@aosipov)

    anyone?:)

    Thread Starter aosipov

    (@aosipov)

    Not helpful:)
    Thank you though

Viewing 15 replies - 16 through 30 (of 40 total)