Forum Replies Created

Viewing 15 replies - 1 through 15 (of 25 total)
  • The problem is due to the fact that the roles aren’t set for logged out users. You need to wrap the foreach/etc. in an if clause. Code would look like this:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Thread Starter Nader

    (@naderc)

    I think the error came from the twittertools plugin that wasn’t able to connect. Just weird that the errorlog says mailchimp-widget.

    Thanks for your help anyway!

    Thread Starter Nader

    (@naderc)

    Sorry, saw there was another thread for it but there it was mainly a hack and not a clean solution.

    There is a wordpress plugin for that called “Tabbed Widgets”.
    You’ll find it in the extend > plugins section on www.ads-software.com

    just added the feature to show comments from a specific category to my plugin “most comments”. let me know if that works for you.

    would you be interested in me extending the “most comments” plugin to make use of this function? i’m generally thinking about new features.

    https://www.ads-software.com/extend/plugins/most-comments/

    Forum: Your WordPress
    In reply to: My new eating blog

    looks very nice and the idea is also good

    Thread Starter Nader

    (@naderc)

    Oh, I forgot the colored themes! ?? The color you select gets saved in a cookie.

    i like scheme1gp0.jpg best

    have you got a working solution yet, that shows how to do this with the filter?

    i’m always getting this error:


    Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'clear_htaccess' was given in /home/brandinfection/www/wp-includes/functions.php on line 1303

    Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/brandinfection/www/wp-includes/functions.php:1303) in /home/brandinfection/www/wp-content/plugins/ncStats/ncStats.php on line 40

    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/brandinfection/www/wp-includes/functions.php:1303) in /home/brandinfection/www/wp-content/plugins/ncStats/ncStats.php on line 40

    Warning: Cannot modify header information - headers already sent by (output started at /home/brandinfection/www/wp-includes/functions.php:1303) in /home/brandinfection/www/wp-content/plugins/ncColors/ncColors.php on line 61

    Thread Starter Nader

    (@naderc)

    i have some kind of logic going on in the brands template page.

    i don’t know at what part i should add a filter and how everything fits together. i’ve never done something with filters.

    basically i have to add this function to the plugin and somewhere add filter? what do i do in the template page?

    in my plugin i have functions like:
    one_brand($ID)
    all_brands($letter, $in, $limit, $breakafter, $orderby)

    Excerpt, brands.php template page:

    <?php
    // adaption for WP2: just isset doesn't work anymore, that's why we assign $_GET to $l, etc.
    $l = $_GET['l'];
    $b = $_GET['b'];
    $in = $_GET['in'];
    // adaption end

    if (! isset($b)) {
    if (! isset($l) && ! isset($in)) {
    $letter = "";
    echo '<h2 class="capheadsmall" style="padding-top: 10px">RECENTLY ADDED BRANDS</h2>';
    all_brands($letter, $in, 21, 3, 'date');
    } elseif (isset($l)) {
    $letter = $l;
    echo '<h2 class="capheadsmall" style="padding-top: 10px">BRANDS: ' . $letter . '</h2>';
    all_brands($letter, $in, null, 3, 'brand_name');
    } elseif (isset($in)) {
    echo '<h2 class="capheadsmall" style="padding-top: 10px; text-transform: uppercase;">' . str_replace("-", " ", $in) . ' Brands</h2>';
    all_brands($letter, str_replace("-", " ", $in), null, 3, 'brand_name');
    }

    } else {
    if (! isset($b)) {
    $ID = "";
    } else {
    $ID = $b;
    }
    one_brand($b);
    all_ads($ID, $in, $letter);
    brand_news($b);
    }

    Excerpt plugin:


    function one_brand ($ID) {
    $letter = $_GET['l'];
    global $wpdb;
    $sql = "SELECT ID, brand_name, brand_desc, brand_industry, brand_link, brand_img FROM wp_brands WHERE ID = $ID AND brand_active = 1";
    $results = $wpdb->get_results($sql);
    $output = '';
    foreach ($results as $result) {
    $brand_name = stripslashes($result->brand_name);
    $brand_link = $result->brand_link;
    $brand_img = $result->brand_img;
    $brand_desc = stripslashes($result->brand_desc);
    $brand_industry = $result->brand_industry;
    $output .= '<div style="line-height: 17px; padding-top: 10px">' . $before;

    if ($brand_img != "") {
    $output .= '<div style="float: right; padding-left: 20px; padding-bottom: 0px; padding-top: 10px"><img src="/wp-content/random-brand/' . $brand_img . '" style="margin: 3px 0 5px 0" alt="Link: ' . $brand_name . '" /></div>';
    }

    $output .= '<h2 style="padding-bottom: 0px; margin-bottom: 3px; color: #2e2e2e">'. $brand_name . '</h2>Industry: ' . $brand_industry . '
    ' . $brand_link . '

    ' . $brand_desc . $after . '</div>';
    }
    echo $output;

    // Display Brandlinks
    $sql = "SELECT * FROM wp_brands_links WHERE brandID = $ID";
    $results = $wpdb->get_results($sql);
    if ($results != "") {
    $output = '<div class="brands_links"><h4 style="margin-top: 0; padding-top: 3px">Pages found on ' . substr($brand_link, 7) . ' <span style="font-weight: normal">(beta)</span></h4>';
    $trenn = "";
    foreach ($results as $result) {
    $type = $result->type;
    $link = $result->link;
    if ($type == 4) { $output .= $trenn . 'About'; $trenn = " | "; }
    if ($type == 1) { $output .= $trenn . 'News'; $trenn = " | "; }
    if ($type == 6) { $output .= $trenn . 'Products'; $trenn = " | "; }
    if ($type == 7) { $output .= $trenn . 'Shop'; $trenn = " | "; }
    if ($type == 5) { $output .= $trenn . 'Jobs'; $trenn = " | "; }
    if ($type == 2) { $output .= $trenn . 'Press'; $trenn = " | "; }
    if ($type == 3) { $output .= $trenn . 'Contact'; $trenn = " | "; }
    }
    echo $output . "</div>";
    }

    // Display Slogans
    $sql = "SELECT * FROM wp_brands_slogans WHERE brandID = $ID ORDER BY year DESC";
    $results = $wpdb->get_results($sql);
    if ($results != "") {
    $output = '<h2 class="capheadsmall" style="margin-top: 30px; margin-bottom: 5px; text-transform: uppercase">' . $brand_name . ' Slogans</h2><table cellpadding="0" cellspacing="0" width="100%">';
    foreach ($results as $result) {
    $slogan_desc = stripslashes($result->desc);
    $slogan_year = $result->year;
    if($slogan_year == "0000") { $slogan_year = ""; }
    $output .= '<tr><td width="90%" style="border-bottom: 1px solid #F3E9E2">' . $slogan_desc . '</td><td width="10%" style="padding: 3px 0px 3px 0px; border-bottom: 1px solid #F3E9E2">' . $slogan_year . '</td></tr>';
    }
    echo $output;
    echo "</table>";
    }
    }

    Thread Starter Nader

    (@naderc)

    I’d be even willing to buy you a small book at amazon.com or something :), if it would work out.

    Thread Starter Nader

    (@naderc)

    OMG, damn…I should have known earlier. Argh.

    Do you know how to do this URL interception thing? At what points? in the template or just the plugin?

    Thread Starter Nader

    (@naderc)

    RewriteRule ^brands/([0-9]+)/([A-Z])/?.* https://beta.brandinfection.com/brands/?b=$1&l=$2 [L]

    This rule works for URLs like
    https://beta.brandinfection.com/brands/139/W/Wonka

    but at the end there’s written
    https://beta.brandinfection.com/brands/?b=139&l=W

    in the url bar.

    Thread Starter Nader

    (@naderc)

    /brands is a wordpress page with page-name “brands”, so it’s not a real directory

    Story behind:
    I wrote a plugin, that displays all various brands. I then created a page template called “brands” (brands.php) which i use as normal wordpress page. With a couple of functions out of the plugin.

    I tried to change [L] to [R] and you’re right, that works but is not the nice-url I want to have.

    Hm, weird. What do you think?

Viewing 15 replies - 1 through 15 (of 25 total)