Category page title

ClassiBase classifieds script Forums Tips and tricks Category page title

This topic contains 5 replies, has 2 voices, and was last updated by  Cesar Pena 2 years, 6 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1915 Reply

    Cesar Pena
    Participant

    Is there a way to make the title of the category page show a word before the category. For example the category is Dogs.
    I would like the title to read “Books on Dogs”

    I would like the words “Books on” to appear before every category title. But, i dont want to make the category “Books on dogs” due to the fact that it would look awful in the category list widget.

    #1919 Reply

    ClassiBase
    Keymaster

    Simple answer is not possible with some tweaks (but not perfect, also check answer http://classibase.com/forums/topic/category-page-title/#post-1920).

    But you can try with this method described in “second way” here http://classibase.com/forums/topic/remove/#post-1620 to translate. It may work in limited way. You should have location name and category for it to work. For example for “Dogs” category and “London” location title will be “Dogs in London”. If you use method described in that method and define translation as “Books on {name} in {name2}” then your title will be “Books on Dogs in London”. When visitor goes to only category without location then title will stay in old way “Dogs” without “Books on ” because there is no location.

    #1920 Reply

    ClassiBase
    Keymaster

    Other solution (this one is better) can be defining all your categories in “Books on Dogs” format and removing “Books on ” part from category widgets with javascript.

    Navigate to “Settings” -> “Header / footer” on “Admin panel”. Paste custom javascript to “Custom footer” field.

    Add following javascript snipped to it.

    <script>
    function removeTextFromCategoryName(str){
    	$('.widget_categories a,select[name="category_id"] option').each(function(){
    		var content = $(this).html();
    		var search_regex = new RegExp(str, 'i');
    		if(content.search(search_regex)!=-1)
    		{
    			$(this).html(content.replace(search_regex,''));
    		}
    	});
    }
    addLoadEvent(function(){removeTextFromCategoryName('Books on ');});
    </script>
    #1922 Reply

    Cesar Pena
    Participant

    The third option works like a charm. Thanks!

    On the same note is there a script i can put in the same place to remove the words “book on” from the category selection dropdown menu when posting a new add?

    Thanks again

    #1937 Reply

    ClassiBase
    Keymaster

    Updated javascript code to process dropdown boxes when posting and editing ad.
    http://classibase.com/forums/topic/category-page-title/#post-1920

    #1944 Reply

    Cesar Pena
    Participant

    works great thanks

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Category page title
Your information: