WordPress.org

Ready to get started?Download WordPress

Forums

Another WordPress Classifieds Plugin
[resolved] Plugin widget mod help (9 posts)

  1. initialhit
    Member
    Posted 1 year ago #

    Hey yall! Wanting to use this plugin solution since it has just about everything my client wants, but need the recent ad posting widget to stretch across sideways and not vertically as it's in a footer region. What part of the code do I need to manipulate? Haven't programmed in PHP in years and can't follow the code. Website: http://www.postyourpiece.com/beta/
    Thanks!
    -initialhit

    http://wordpress.org/extend/plugins/another-wordpress-classifieds-plugin/

  2. awpcp
    Member
    Plugin Author

    Posted 1 year ago #

    Hi initialhit,

    You might not need to change the PHP to do this. Have you tried using custom CSS to alter the width of the div that encloses the widget? That shouldn't be too hard using Firebug (http://getfirebug.com)

    That, plus a custom CSS file for AWPCP (article here: http://www.awpcp.com/forum/viewtopic.php?f=3&t=1234) ought to do it.

  3. initialhit
    Member
    Posted 1 year ago #

    will give it a shot! Just making sure it wasn't hard coded.

  4. engemaen
    Member
    Posted 1 year ago #

    Hi, same here.

    I actually tried to define my own css prefix.
    But the search do not change.

    The actually result you see on .

    I want a margin between the words, you know?
    I want to change the search button an the search field.

    I would be glad for any Help.

    Thank you and best regards from Germany

    David

  5. awpcp
    Member
    Plugin Author

    Posted 1 year ago #

    Hi David,

    Read the Custom CSS link above--it tells you how to use Firebug to find these elements and make the right adjustments in the custom CSS file.

    Your theme will handle these a little differently from all other themes (that's the point--for themes to have a unique look!), so I can't offer generic advice on it. You'll need to inspect elements with Firebug and find them, try changes, and then save them in the custom CSS file.

  6. engemaen
    Member
    Posted 1 year ago #

    Thank`s, i will have another try this night.
    If i won`t get i will you have notice.

  7. initialhit
    Member
    Posted 1 year ago #

    Hey,
    got it work... but it's not as simple as you put it.
    So how WP handles stuff in the footer made it fun.
    First and foremost... wordpress core manipulates it, your theme of choice has a hand in manipulating the widget area, wordpress core manipulates it, and then it gets to your actual widget. In order for me to get it to work I had to do some cleanup on your widget, deleting all your <divs>, which it automatically will only generally put one of those per line unless you place the layer tag on them. The item that was causing problems was the
    <li> and
    <ul> tags, replaced them <td> and <tr>, respectively. Then I had to remove the <h3> tag and replace it with the tag. Code of the mod on your widget is below:

    function awpcp_sidebar_headlines($limit, $showimages, $showblank, $show_title, $show_excerpt) {
        $output = '';
        global $wpdb,$awpcp_imagesurl;
        $tbl_ads = $wpdb->prefix . "awpcp_ads";
    
        $awpcppage=get_currentpagename();
        $awpcppagename = sanitize_title($awpcppage, $post_ID='');
        $permastruc=get_option('permalink_structure');
        $quers=setup_url_structure($awpcppagename);
        $displayadthumbwidth = intval(trim(get_awpcp_option('displayadthumbwidth'))) . 'px';
    
        if(!isset($limit) || empty($limit)){
            $limit = 10;
        }
    
        $query = "SELECT ad_id,ad_title,ad_details FROM ". AWPCP_TABLE_ADS ." ";
        $query.= "WHERE ad_title <> '' AND disabled = 0 ";
        // $query.= "AND (flagged IS NULL OR flagged = 0) ";
        $query.= "ORDER BY ad_postdate DESC, ad_id DESC LIMIT ". $limit . "";
        $res = awpcp_query($query, __LINE__);
    
        while ($rsrow=mysql_fetch_row($res)) {
    
            $ad_id=$rsrow[0];
            $modtitle= awpcp_esc_attr($rsrow[1]);
            $hasNoImage = true;
            $url_showad=url_showad($ad_id);
    
            $ad_title="<a href=\"$url_showad\">".stripslashes($rsrow[1])."</a>";
            if (!$showimages) {
                //Old style, list only:
                $output .= "$ad_title";
            } else {
                //New style, with images and layout control:
                $awpcp_image_display="<a  href=\"$url_showad\">";
                if (get_awpcp_option('imagesallowdisallow')) {
                    $totalimagesuploaded=get_total_imagesuploaded($ad_id);
                    if ($totalimagesuploaded >=1) {
    		    $displayadthumbwidth = "175px";
                        $image = awpcp_get_ad_primary_image($ad_id);
                        if (!is_null($image)) {
                            $awpcp_image_name_srccode="<img src=\"" . awpcp_get_image_url($image) . "\" border=\"0\" width=\"$displayadthumbwidth\" alt=\"$modtitle\"/>";
                            $hasNoImage = false;
                        } else {
                            $awpcp_image_name_srccode="<img src=\"$awpcp_imagesurl/adhasnoimage.gif\" width=\"$displayadthumbwidth\" border=\"0\" alt=\"$modtitle\"/>";
                        }
                    } else {
                        $awpcp_image_name_srccode="<img src=\"$awpcp_imagesurl/adhasnoimage.gif\" width=\"$displayadthumbwidth\" border=\"0\" alt=\"$modtitle\" />";
                    }
                } else {
                    $awpcp_image_name_srccode="<img src=\"$awpcp_imagesurl/adhasnoimage.gif\" width=\"$displayadthumbwidth\" border=\"0\" alt=\"$modtitle\"/>";
                }
    
                $ad_teaser = stripslashes(substr($rsrow[2], 0, 50)) . "...";
                $read_more = "<a href=\"$url_showad\">[" . __("Read more", "AWPCP") . "]</a>";
                $awpcp_image_display.="$awpcp_image_name_srccode</a>";
    
                $awpcp_image_display = (!$showblank && $hasNoImage) ? '' : $awpcp_image_display;
                $html_title = "<strong>$ad_title</strong>";
                $html_excerpt = $show_excerpt ? "<p>$ad_teaser<br/>$read_more</p>" : '';
    
                $output .= "<td>$awpcp_image_display  $html_title $html_excerpt</td>";
            }
        }

    [Moderator note: Please wrap all code in backticks]

  8. initialhit
    Member
    Posted 1 year ago #

    I decided I didn't want text associated, so I also commented out these two lines like such:

    //$html_title = "<strong>$ad_title</strong>";
    //$html_excerpt = $show_excerpt ? "$ad_teaser<br/>$read_more" : '';

    In the end, the way I am doing it bypasses all of the themes and WP-Core css manipulations as they don't have anything for xhtml tags like ... took me about 6 hours to get it, but enjoy everyone :)

  9. initialhit
    Member
    Posted 1 year ago #

    and instead of firebug, you can use inspect element in chrome as well ;)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic