Forum Replies Created

Viewing 15 replies - 91 through 105 (of 126 total)
  • Chris

    (@web2guru)

    Sorry, wrong post, refer to
    this topic

    Chris

    (@web2guru)

    I ham having the same issue. Looking through the code, I found out that the setting only works to stop it from linking the page title to the same page.

    I.E. – if the page title is “Home Remedies” then it will not link the words “Home Remedies” on that page back to itself.

    No solution yet, just wanted to explain what was happening. I’m looking for a way to mod the plugin so it also doesn’t link custom keywords to their respective pages.

    Thread Starter Chris

    (@web2guru)

    It’s not a fix, but since the buttons are useless in this case, I have hidden them and expanded the scrolling area to the full width. Here are the additional skin styles I added to the bottom of the tango skin.css.

    .jcarousel-prev, .jcarousel-next {
        display: none !important; /* hide buttons */
    }
    .jcarousel-skin-tango .jcarousel-container-horizontal {
        padding: 20px !important; /* remove space for buttons */
        width: 900px !important; /* set to page width */
    }
    .jcarousel-skin-tango .jcarousel-clip-horizontal {
        width: 100% !important; /* use full space for carousel */
    }

    The .jcarousel-container-horizontal width setting was 90% plus the padding, which I reduced since that is where the buttons were, so you could do something like 95%, but using percents doesn’t give you exact measurements and I wanted it to be exactly as wide as my theme, which is 900px, so that is what I used.

    Also not sure why .jcarousel-clip-horizontal was set to 97%, just short of the full width, I guess to put a little more white space between the images and the right arrow, but it is not necessary, and without buttons it looks better at full 100% width.

    Chris

    (@web2guru)

    Basically, if a post is in more than one category but you only want to display posts from one of those categories, you have to specify the id of the desired category.

    [catlist id=9]

    The rest just gives you more advanced options.

    Chris

    (@web2guru)

    Sorry, don’t do that, let me correct myself.

    You would only need to use the id of the category you want, not the id of the category you don’t want. Specifying the id of the category you do not want would cause it to not display posts that are in BOTH categories).

    This is all you need:

    // post's first category id is 9
    [catlist id=9]

    On another note…

    I have not fully tested the following code, but it should work. If you are comfortable with editing the theme code, you can do something similar in the loop in single.php (or other desired template). This way you would not need to know the category id, but it would display a catlist on all posts (unless you add some conditionals).

    This code would get the categories that a post is in and only display the catlist for the first category

    $theCategories = get_the_category();
    $category1 = $theCategories[0]->term_id;
    echo do_shortcode("[catlist id=$category1]");

    Like my first code examples, this code will do the same, and excludes posts that are also in the other categories.

    $theCategories = get_the_category();
    $category1 = $theCategories[0]->term_id;
    if(isset($theCategories[1])) $category2 = $theCategories[1]->term_id;
    if(isset($theCategories[2])) $category3 = $theCategories[2]->term_id;
    ...
    echo do_shortcode("[catlist id=$category1,-$category2,-$category3...]");

    Make sure those last two codes blocks are used inside the loop.

    Chris

    (@web2guru)

    That is correct, it is not possible to do it that way. You would have to use the id of the category you want (or the name with a mod) instead of categorypage.

    i.e. you want posts in category id 9 but not posts also in category 10:

    [catlist id=9,-10]

    Alternatively, there is a modification you can make to use the name setting instead. I’ve posted the updated changes here.

    i.e you want posts in category-a but not posts also in category-b:

    [catlist name=category-a,-category-b]

    Chris

    (@web2guru)

    It has come to my attention that the first part of this mod could be confusing. In order to have posts that are in all the specified categories except posts that are in other specified categories (your using + and not ,) you need to use +- before the category to exclude.

    Here are some examples:

    // Given example (AND)
    // Only gets posts that are in both categories (+ = AND)
    [catlist name=category1+category2]
    
    // Given example (OR)
    // Gets posts that are in either categories
    [catlist name=category1,category2]
    
    // Mod example (AND, EXCEPT)
    // Get posts in either category-a OR category-b
    // but not posts that are is also in category-c
    [catlist name=category1,category2,-category3]
    
    // Mod example (OR, EXCEPT)
    // Get posts in both category-a AND category-b
    // but not posts that are is also in category-c
    [catlist name=category1+category2+-category3]

    I have not tested the AND shortcode, but it should work. Correct me if I am wrong.

    Chris

    (@web2guru)

    +1 for wanting this feature.

    The code has changed since this was posted, it is now in two places, near lines 143 and 154. Here is the full if/else block in that area, with the modifications (MOD) shown:

    if (preg_match('/\+/', $this->params['name'])):
            $categories = array();
            $cat_array = explode("+", $this->params['name']);
            foreach ($cat_array as $category) :
              // $id = $this->get_category_id_by_name($category); // MOD - replaced with the following mod
              // MOD
              $id='';
              if(strpos($category, '-')===0){
                $id='-';
              }
              $id .= $this->get_category_id_by_name($category);
              // MOD END
              $categories[] = $id;
            endforeach;
            $this->lcp_category_id = $categories;
    
          elseif (preg_match('/,/', $this->params['name'])):
            $categories = '';
            $cat_array = explode(",", $this->params['name']);
    
            foreach ($cat_array as $category) :
              // $id = $this->get_category_id_by_name($category); // MOD - replaced with the following mod
              // MOD
              $id='';
              if(strpos($category, '-')===0){
                $id='-';
              }
              $id .= $this->get_category_id_by_name($category);
              // MOD END
              $categories .= $id . ",";
            endforeach;
    
            $this->lcp_category_id = $categories;
    
          else:
            $this->lcp_category_id = $this->get_category_id_by_name($this->params['name']);
          endif;
    Chris

    (@web2guru)

    The syntax is correct, however the categorypage and id settings (and name setting) can not be used together.

    The code goes: if categorypage … elseif name … elseif id

    You would need to use the name or id if the post is in more than one category and you only want the first category.

    Chris

    (@web2guru)

    I’d like this too, but until then, here is an interesting idea…

    We can use multi-page pages with a separate shortcode for each page, and use the offset setting. Something like:

    [catlist name=mycategory]
    <!--nextpage-->
    [catlist name=mycategory offset=10]
    <!--nextpage-->
    [catlist name=mycategory offset=20]
    ...

    You would have to keep up with how many posts you have and update the page with another page break and shortcode periodically, but it works!

    Thread Starter Chris

    (@web2guru)

    So I have narrowed it down to some conflict with the themes [raw] tags, which are used to stop wpautop from messing with their shortcode output, and when the plugin applies filters to the post content.

    Here is the code they have used for their [raw] tags:

    function my_formatter($content) {
    	$new_content = '';
    	$pattern_full = '{(\[raw\].*?\[/raw\])}is';
    	$pattern_contents = '{\[raw\](.*?)\[/raw\]}is';
    	$pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE);
    
    	foreach ($pieces as $piece) {
    		if (preg_match($pattern_contents, $piece, $matches)) {
    			$new_content .= $matches[1];
    		} else {
    			$new_content .= wptexturize(wpautop($piece));
    		}
    	}
    
    	return $new_content;
    }
    
    remove_filter('the_content', 'wpautop');
    remove_filter('the_content', 'wptexturize');
    add_filter('the_content', 'my_formatter', 99);

    Thread Starter Chris

    (@web2guru)

    Ok, another update. The downside to commenting out the filters is that now content that consists of multiple paragraphs all runs together (as would be expected).

    So instead of wrapping the content in paragraph tags, I changed it to div tags.

    $lcp_display_output .= $this->get_content($single, 'div', 'lcp_content');

    Now the paragraphs and all the html comes out correctly with filters applied, but the [raw] tags are still displayed around both their separator shortcode’s output and your shortcode’s output.

    Any idea what causes this?

    Thread Starter Chris

    (@web2guru)

    So with a little testing, the obvious problem was applying filters to the content. I commented that out of the Catlist.php, line 292, and now it all works perfectly, [raw] tags and all.

    Some additional info, here is the shortcode I am using:

    [catlist name=my-category content=yes thumbnail=yes template=my-template]

    Chris

    (@web2guru)

    It’s not a perfect solution, I have a similar issue.

    The jquery carousel scrolls by one logo at a time (or more depending on your “Scroll Amount” setting), and this does not interrupt that scrolling process, it simply pauses the script so the next scrolling process is not started. So after hovering over an image, the current scrolling process continues to scroll the logo at the far left out and the next logo is flush to the left side.

    It also appears that mousing over an image and then back out really quick can cause the scrolling to stop until you scroll back over another logo. My guess is that the script is ready to be paused, but once you hover over an image and it receives the pause command, while it is still handling the last scroll process, it is not ready to un-pause so it does not catch the mouse leaving the image. If the mouse moves back over an image and back off, it starts up again (at least for me it does).

    Also note my settings: I have slowed the scroll speed to 2000, have set the scroll amount to 1, and set auto-scroll to continuous. A faster scroll speed will lower the time it takes to pause, a higher scroll amount will cause more logos to be scrolled out before it pauses, and I’m not sure how the other auto-scroll settings will affect it.

    Thread Starter Chris

    (@web2guru)

    Thanks for the reply, Ravan. I got it working. I pulled some of the code from the plugin script and turned it into a second function (currently added to my themes scripts.js). It’s a short function, you could add this to the plugin and call it from within the get_hlst_query function (in place of the original code).

    Here is the new function:

    function ajaxHighlight(hlst_areas,hlst_query) {
    	var area; var i; var s;
    	for (s in hlst_areas){
    		area = jQuery(hlst_areas[s]);
    		if (area.length != 0){
    			for (var l = 0; l < area.length; l++) {
    				for (i in hlst_query){
    					area.eq(l).highlight(hlst_query[i], 1, 'hilite term-' + i);
    				}
    			}
    		}
    	}
    }

    Then just call the function at the end of the ajax post (the variables are already loaded on the page).

    ajaxHighlight(hlst_areas,hlst_query);

    On a side note, I had to remove the break in the for loop because it would not do highlighting in the other “areas” I specified. Not sure what purpose this has here, but it worked perfectly after removing it. Why would you stop it from looping through the other specified areas?

Viewing 15 replies - 91 through 105 (of 126 total)