Results 1 to 1 of 1

Thread: I have made a few changes to the plugin.

  1. #1
    Thread Starter
    henrikg's Avatar
    Join Date
    Dec 2011
    Location
    Denmark
    Posts
    97
    Thanks
    0
    Thanked 8 Times in 6 Posts

    I have made a few changes to the plugin.

    Hi.

    On my site I did not wan't to use the slider on the front page. In stead I wanted to use it on the category pages as well as on tag pages and search.

    I have reserved the front page of my site to include a different slider in order to draw users to the blog posts.

    So instead of adding the slider to the tpl-ads-home.php file, I placed it in:

    taxonomy-ad_cat.php
    taxonomy-ad_tag.php
    search.php

    It works, pretty well, but I discovered that the plugin is not optimized for these theme locations.

    The plugin would search for all featured ads across ad categories, thereby giving not so great results for the user who are browsing more specific ads.
    Another thing I noticed, was that the plugin reads all posts, and then filters those out who does not have an image.

    And it altered the original query using query_posts(), which is not recommended because of performance.

    In short

    1. It can't select ads with images, but have to select all ads and then filter out the ads without images.
    2. It is not limited by the selected categories.
    3. The plugin use the query_posts(), which executes the main query twice.


    Number 1 is a design flaw in wordpress, because images are just attachements, You can not create query to the database that can search for image attachments. However it is possible to create a query that search for a featured image on the post. So in order to be able to handle this, all you have to do is to make sure that your posts always creates a featured image, if the ad is created with a post.

    This can be handled if you install a plugin like the "Auto Post thumbnail" You can configure that to always make sure that a post of a given post type has a featured image. I honestly do not understand why this is not a standard feature of classipress, but it is not.

    With that plugin installed I was able to alter the query and only select between posts with images, thereby limiting the load on the database

    Number 2 can be handled by finding the ad categories of the ads being displayed on the page, and then ad a taxonomy query to the post query.

    Number 3 was an easy fix, instead of using the query_posts, I created a sub query, only for the seven posts needed to select the featured ads.

    Since this is a purchased plugin, I can not post the code here, but I would be happy to send the changes to the plugin author if he would like.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 544
    Last Post: March 20th, 2016, 09:13 AM
  2. Samcy New ads being made featured
    By epijunky in forum Report ClassiPress Bugs
    Replies: 3
    Last Post: January 14th, 2013, 12:33 AM
  3. Some made changes i really like
    By arnanp in forum Vantage General Discussion (Legacy)
    Replies: 1
    Last Post: September 22nd, 2012, 12:46 PM
  4. ClassiPress Mobile Plugin - can it me made iphone APP
    By dismacoa in forum ClassiPress General Discussion
    Replies: 1
    Last Post: April 23rd, 2012, 10:44 AM