Forum Replies Created

Viewing 15 replies - 256 through 270 (of 681 total)
  • Plugin Author Eric Mann

    (@ericmann)

    Unfortunately, that’s not something I had in mind when I originally built the plugin, so there isn’t a convenient hook to switch the ordering – it’s hard coded to order by the publication date of the posts …

    However, you can hack the existing plugin if you really need this functionality now.

    Around line 63 of /lib/class.wp-publication-archive.php you can see where the default arguments are specified to query for publications. Find the line 'orderby' => 'post_date', and change it to 'orderby' => 'title',. Then find the line 'order' => 'DESC', and change it to 'order' => 'ASC',.

    I will also try to work this functionality into the next version, but please know that whatever changes you make today will be lost when you eventually upgrade.

    Plugin Author Eric Mann

    (@ericmann)

    @dtoxik This is an issue I’ve been unable to recreate. What are the exact steps you are taking to produce this issue? What version of WordPress? What other plugins are installed?

    Yes, it’s possible. I just set it up on my own server, and it’s working just fine. Be sure to use the WordPress module rather than the Apache module for your redirects – no Apache means no .htaccess file.

    This is a known bug … to fix it, replace that function with:

    public static function the_title( $title, $id = null ) {
        if ( null == $id ) return $title;
    
        $post = &get_post( $id );
        if ( 'publication' != $post->post_type )
            return $title;
    
        return $title . " (Download Publication)";
    }

    The problem is that the title filter normally passes two parameters, and some other plugins aren’t actually sending both of them. The calendar plugin you’re using is the offender in this case, but I’m not handling situations where plugins pass the wrong number of parameters. This replacement function will handle that a bit more elegantly.

    Eric Mann

    (@ericmann)

    That’ll do it 🙂

    Eric Mann

    (@ericmann)

    Just wrap things with is_page(). You can pass in the page ID or the page slug.

    So …

    <div id="feature">
      <?php if ( is_page( 'drunk-driving' ) ) { ?>
        <div id="drunk-driving">
          ...
        </div>
      <?php } else { ?>
        <div id="featurearea">
          ...
        </div>
      <?php } ?>
      <div id="feature-footer">
        ...
      </div>
      <div class="clear"></div>
    </div>
    Plugin Author Eric Mann

    (@ericmann)

    Please submit your changes as a patch, or fork the plugin on GitHub (https://github.com/ericmann/WP-Publication-Archive) and submit a pull request so I can include this functionality.

    How is replacing: “[site_url]” a complex regex nightmare in comparison to replacing “website.com”. Seems like it’s really obvious simple string replace to me.

    The way I see it, both methods are fairly expensive when it comes to processing. As it stands, post content is filtered minimally for certain shortcodes. Not a big deal, but can become one when you start installing several additional plugins.

    That said, I’d much rather parse content and replace [site_url] than parse and replace website.com. It’s a more explicit flag that content needs to be replaced (think of email addresses, for example).

    Using the 80/20 rule, though, the majority of users will never need this kind of flexibility. Much of these users will also be running in an uncached environment, meaning any post processing will add significant server load for every post that includes links.

    That said, I can definitely see the benefit for specific groups of users and would love to see this kind of functionality extended via a plugin. Simply drop the plugin into your site and parse [site_url] like any other shortcode. Also, override the link editor to automatically insert that shortcode rather than the site URL.

    I can see the value for some users, and someone (me, another dev, anyone with interest) should look into coding this out.

    One of the things that we did was to ensure that all hardcoded local link to posts and images was to use a simple bbcode/shortcode hook.

    POSTS:
    e.g. “link.com/post-name” became [site_url]post-name

    MEDIA:
    e.g. “link.com/wp-content/uploads/month/year/image.jpg” became [image_url]image.jpg

    Is this shortcode solution available as a plugin? I have a feeling it would satisfy the devs/users who need such a solution without needing to draw on this debate over absolute/relative/referenced URLs in core.

    I was on the other side of the relative URL debate (as in, disagreeing with Otto). But there’s a very important thing to understand here – developers are not the same thing as users.

    Aside from being hard-headed and simply incorrect on nearly every single front, Otto does a great job of alienating those who should constitute a significant portion of WP’s target audience: developers.

    Yes, developers use WordPress to build sites. We spend a lot of time hacking code and migrating installations from one machine to another. But we are not the end user – our customers are.

    Our customers couldn’t care less about relative versus absolute URLs. They just want the software to work so they can generate content, manage sales, and drive traffic to registration forms. The majority of users (remember, WP is used to power millions of sites) will not be migrating from one box/url to another and will never need relative URLs or the cacophony of things that break when they’re introduced.

    Yes, relative URLs might make life easier for me. They might make things easier for you. They might make things easier for a hundred or so other developers. But focusing on a hundred or so people at the expense of millions of other users is a really bad idea.

    Oh, and for the record I’ll profess right now that Otto is a WP guru. His reputation is well earned in the community.

    Plugin Author Eric Mann

    (@ericmann)

    When you add a publication, WordPress stores the link to the publication in the database. Moving your site to a new server will not change these links.

    You need to go in and edit the URL for each publication after you migrate. I know, it’s time consuming and annoying, but the plugin isn’t capable of handling data migrations at this point.

    Sharon, can you post your modified code to a Pastebin so we can see what you’ve done?

    Plugin Author Eric Mann

    (@ericmann)

    Yes, I plan to include additional shortcode filtering in a future version.

    No, no settings page. Instead, the output will be entirely theme-able (you can override the default layout and styling by creating your own template). This is also coming in a future version.

    There’s no “easy” way to realize that output as a shortcode at the moment. However, there is a full set of template tags available in /lib/class.publication-markup.php. You can call functions like get_the_title() and get_the_thumbnail() just as you would with posts.

    Plugin Author Eric Mann

    (@ericmann)

    What other plugins are you running? If I can reproduce this bug on my own system, I should be able to give you a more permanent fix.

    Plugin Author Eric Mann

    (@ericmann)

    Forgot to recommend target=blank. The point of openfile.php was to force the link as a download (content-disposition=attachment) so that it wouldn’t open in the same window. Without that, you’ll need target=blank 🙂

Viewing 15 replies - 256 through 270 (of 681 total)