Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter johncory

    (@johncory)

    OK, so not really sure why but I when I add the parameter page=1 to the URL, this resolves my issue of having to click twice.

    I changed this:

    $link = "<a class='wpfp-link' href='?wpfpaction=".$action."&postid=". $post_id . "' title='". $opt ."' rel='nofollow'>". $opt ."</a>";

    to this

    $link = "<a class='wpfp-link' href='?wpfpaction=".$action."&page=1&postid=". $post_id . "' title='". $opt ."' rel='nofollow'>". $opt ."</a>";

    I probably commented out something about paging somewhere. I also noticed that it worked without that edit if I was logged in as an administrator.

    I changed query_posts to new wp_query in the wpfp-page-template.php but also turned JS off in the admin. I have another answer with some code towards the new wp_query if you look around. One of the two worked for me.

    I haven’t tried this, but if you add a query to the list page that does ‘post_type’ => ‘page’ to query the pages and then you just put the wpfp_link on the page template, might that work?

    here’s what I did —

    1. copy the wpfp-page-template.php into your theme — not sure if that’s obvious to others. it wasn’t to me.
    2. Umm… rewrite the template a bit to suit your purposes. for me, it was the following (note I change the query from query_posts to new wp_query and use a custom post type):
      if ($favorite_post_ids) {
      
          $favorite_post_ids = array_reverse($favorite_post_ids);
          $post_per_page = wpfp_get_option("post_per_page");
          // $page = intval(get_query_var('paged')); // I don't need this
      
          $sectors = array(
            'post_type' => 'sectors',
            'post__in' => $favorite_post_ids,
            'posts_per_page'=> $post_per_page,
            'orderby' => 'post__in'
          );     
      
      /*
      *  Sectors
      *  ==================================
      */
      
          $sectors_query = new WP_Query( $sectors );
          if ( $sectors_query->have_posts() ) { ?>
             <h2>Sectors</h2>
            <?php
            while ( $sectors_query->have_posts() ) {
              $sectors_query->the_post(); ?>
              <div>
              <?php the_post_thumbnail(); ?>
              <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
              <?php the_excerpt(); ?>
              <p class="btn btn-info btn-xs"><span class="remove-wpfp"><?php echo wpfp_remove_favorite_link(get_the_ID()); ?></span></p>
            </div>
      <?php } // if $sectors_query
          wp_reset_query();

    I actually have a bunch of custom post types and, thus a bunch of arguments and new wp queries going on, but hopefully this is helpful and not the wrong way to do it for some reason. I have noticed that I have to click all of my wpfp_link() buttons twice to make things happen. Hopefully that’s not related to this here. I’m about to post my own question about that in a second.

    Thread Starter johncory

    (@johncory)

    Hey you’re the “pyromancer” so forgive me if I perceived a little buuuuurn. I still can’t tell if you’re joking. You would be correct — a shopping cart is a container. And a bucket is also a container.

    I originally meant keywords pertaining to PHP or WordPress concepts, or plugins, or combinations of those.

    I’m looking for something I can take apart and rebuild to better understand shopping carts and build one myself. I’m trying to start with a simpler goal to make it more attainable. Coincidentally, I have a few use cases for something just like that.

    For example, I re-built one that uses sessions and writes to its own, non-WP table. Problem is, I started with code someone else wrote very quickly, so I’m not sure how efficient the approach is. The second operation seems tacked on to the first one. It’s also pretty specific to the site in a number of ways, so it’s not something I think I can retool into a plugin although I’d like to.

    So, I’m looking for a very simple distillation of a shopping cart … in the realm of WordPress actions, hooks, functions, etc. Not like a metal basket on wheels.

    Thread Starter johncory

    (@johncory)

    I see what you did there. Is very funny.

    Thread Starter johncory

    (@johncory)

    Thanks, MacManX. Were you thinking of the WP Cache Bucket? http://wordpress.org/plugins/wp-cache-bucket/

    I see how that could be a component, but not sure if that’s what you meant.

    This is the closest thing I can find, but I’m surprised it’s the only one of its kind.
    http://wordpress.org/plugins/wp-favorite-posts/

    I have used Advanced Custom Fields recently to do something very similar with great results.

    The new pro version allows quite a lot of flexibility. It should be very easy for you to customize the backend user interface with intelligent labeling and help text to move your administrators through the content entry process.

    Difficulties I’ve encountered include:

    Bulk import / export of ACF values via CSV is not available out of the box. There are plugins you can use to do that, but they are ten times as expensive as ACF itself. You can also bulk import via MySQL, but YMMV on how easy that is.

    ACF has its own lingo. You have to learn it, but once you do, it’s great.

    The last update to ACF Pro was a little bumpy for me. The bumps are smoothed out now, but at first I was a little panicked to see things “breaking.” I worry that something similar will happen if Elliot Condon joins the circus or hands the project over to someone else, but all of your content is very well organized in the database via ACF. So, migration shouldn’t be more difficult than any other migration I’ve faced.

    You might also look at Relevanssi for the search component.

Viewing 8 replies - 1 through 8 (of 8 total)