Quantcast
Channel: Topic Tag: plugin | WordPress.org
Viewing all articles
Browse latest Browse all 26892

initialhit on "[Plugin: Another Wordpress Classifieds Plugin] Plugin widget mod help"

$
0
0

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]


Viewing all articles
Browse latest Browse all 26892

Trending Articles