ULVEN
ULVEN

WordPress: Remove category link from the_category() function


16 April 2014 — How-To, PHP, WordPressNO COMMENTS

Recently for a project, I needed to create post categories which links were not visible to everybody, yet displaying all other categories pertaining a blog post. To accomplish that it is possible to use the following code:

function the_category_filter($thelist, $separator=' ') {
	if (!defined('WP_ADMIN')) {
		// list the category names to exclude
		$exclude = array('Category_Name_to_Exclude', 'Category_Name_to_Exclude2');
		$categories = explode($separator,$thelist);
		$newlist = array();
		foreach ($categories as $cat) {
			$category_name = trim(strip_tags($cat));
Read article


How to do a “first-word” pseudo-element with jQuery


15 April 2014 — CSS, How-To, JQueryNO COMMENTS

There is no first-word selector in CSS. There is first-letter and first-line. How can we “force” a first-word pseudo-element? By using jQuery.

ulven-icon-jquery

The following snippet states that every time a p tag, followed by the class first-word appears in the HTML code, a span tag will be added to the first word. The code snippet uses substring1, indexOf2 and the .length3 methods to (1) extract the characters from a string and return the new sub string, (2) return the position of the first occurrence of a specified value in a string, and (3) return the number of the elements of the object:

Read article


Add a scroll effect to your site without a plugin with jQuery


10 March 2014 — CSS, JavaScript, JQuery, WordPressNO COMMENTS

The following how-to guide adds a smooth scroll to top effect to your website with jQuery, and without using a plugin. It is based off the tutorial found on WP Beginner, but instead of only applying to Wordpress sites, it can be applied to any website. In the WP Beginner tutorial, the necessary code to create the smooth effect is stored in an external .js file. On top of that, with their version it is necessary to tell Wordpress to add the file to a theme with some code, which ends up linking the external .js file within the header.

ulven-icon-jquery

I place .js scripts according to their function. Those scripts that aren’t necessary to load the main content are always placed at the bottom of my pages, specially in the case of small scripts, which I opt to inline instead of adding as external .js files. This is the case for this feature.

Read article


1 2 3 15