Wordpress - sida 2

17

get_depth()

2010-01-16 @ 14:54

I created a function that returns the depth of a page or category. The depth is how many levels from the root the page or category in its hierarchy. The root level number is 0.

Share
  • omid
    2013-07-08 @ 08:10

    very good peace of code :D
    as for idea i when i was using your code in my theme i face a situation that i have to show categorys only on [...]

  • http://tinyurl.com/newbwinch01500
    2013-01-27 @ 17:34

    I found this blog , “get_depth() - get depth of a page or category - Wordpress
    template tag / function | devdevote.com”, quite pleasurable and also it
    was a good [...]

  • Ivantus
    2012-01-06 @ 00:55

    Hi, great tutorial! I've got one question though. I'd like to show sidebar1 for depth1, sidebar2 for depth2 and so on. Any idea how to achieve this?
    At this point I'm [...]

4

get_id_by_post_name()

2010-01-16 @ 14:53

The function converts a post / page name to a post /page ID.

Share
  • appcropolis
    2012-09-16 @ 20:57

    This is very useful. I did not know about 'get_var'. This is a very quick way to get an specific property of a post/page without having to inspect a post [...]

  • Convert post name into post ID | Q&A System
    2012-08-05 @ 18:45

    [...] into a publish id. I’ve had a glance around on the internet and handled to locate this link http://world wide web.devdevote.com/content management systems/wordpress-hacks/get_id_by_publish_tit... which provides the next [...]

  • Aaron
    2011-02-25 @ 09:00

    Agree with Rama. Even get_by_postname would work...good for anti-collision in a plugin.

4

get_permalink_by_name()

2010-01-16 @ 14:53

I created a function that returns an URL when sending a post / page name as an in parameter. Put the function into your functions.php in your theme folder.

Share
  • Ootes
    2013-03-14 @ 13:15

    This is my approach for the same problem

    function get_permalink_by_title($title){
    $page = get_page_by_title($title);
    $pageID = $page->ID;
    $permalink = get_permalink($pageID);
    return $permalink;
    }

  • AJ Clarke
    2011-05-27 @ 19:16

    This piece of code is great. But if you have made significant revisions to the page (like changing the slug) it gets messed up and shows a slug such as [...]

  • Ann
    2011-04-30 @ 00:44

    This solved a problem for me - many thanks!

3

get_single_cat()

2010-01-16 @ 14:52

I created a function that returns a value depending of the input type. Put the function into your functions.php in your theme folder.

Share
  • vb078
    2013-08-16 @ 13:45

    quick finding a solution for linking get_category_link(get_single_cat('ID'))
    maybe you have some best one ?!

    I searching for multiple category display in the loop right now :)

    Thx you for reading me !

  • vb078
    2013-08-16 @ 13:38

    Hello :)
    I would like to make it with links (linked cat name), It's possible?
    Optionaly can you help with child cat names? (not single)

    Thank you so much
    (adding display-posts-shortcode categories)

  • patrick
    2011-03-09 @ 05:15

    thanks jen , its work for me , i have try it at my categorie page

4

get_user()

2010-01-16 @ 14:51

Wordpress have a built in function called get_currentuserinfo. A global variable is set. It calls a function to get the user information. It then echos the username. The code is not as short and easy as it could be.

Share
  • Harlow
    2010-08-04 @ 18:51

    Hi, this is a great piece of code, thank you! :)

    Since you say if we have any ideas we can write a comment and you’ll look into it, I have [...]

  • Chris
    2010-02-01 @ 03:31

    Thanks man... this was just what i was looking for...

    :)

  • admin
    2010-01-17 @ 14:32

    Try this:
    echo get_user(‘email’);

8

Wordpress have a ”bug”. It doesn’t add a current_cat_ancestor class to the wp_list_pages function. If you need it, you can use the code below.

Share
  • matt mcinvale
    2012-01-04 @ 00:54

    much thanks for sharing this code, worked great with a 3.3.1 install i'm working on.

  • chai
    2010-10-24 @ 13:40

    Can modify with css tab navi manu?

  • Mike
    2010-07-01 @ 16:03

    I put the code in my functions.php file, then got this error: syntax error, unexpected ';', expecting ')'

    The error is in the line Phil is referring to above.

    I changed [...]

26

Add to Header

2010-01-16 @ 14:49

If you need to add a stylesheet, a javascript file or Google Analytics code you normally need to edit your theme header.php file. Add additional code to your header WITHOUT editing your theme with Add to Header.

Share
  • Hugh
    2013-07-11 @ 01:13

    Great plugin. Thanks! I'm happy to make donation to help support this plugin.

  • Nory
    2013-01-15 @ 18:42

    Jens, that's a great little plugin. Many thanks.

  • 12
    2012-05-27 @ 05:10

    Add to Header - Wordpress plugin - Script & code, stylesheet (CSS), Javascript (JS) & Google Analytics | devdevote.com I was suggested this website by my cousin. I am [...]

89

WP Paging

2010-01-16 @ 14:47

Unlike many other page navigation plugins, this one is based on a core page number function called paginate_links. You can modify the paging styles in many ways.

Share
  • Wordpress Sayfa numarası verme eklenti
    2013-02-12 @ 13:27

    [...] WordPress page number download sitesinden indirmemiz gerekiyor, daha sonra Plugins/ yeni menüsünden eklentimizi [...]

  • Prakash Mishra
    2012-11-30 @ 07:13

    Thank you for nice plugin.But there is one problem.I want to see 5 post i.e Can you suggest me how we change the number of records in a page to [...]

  • TAyyeb
    2012-10-26 @ 19:37

    Thanks for sharing this plugin, but also let me know if WP Paging is good or pagenavi good ?

7

I want to use SQL-querys within the Wordpress loop and still be able to use the template tags. Here is the solution.

Share
  • Andrej
    2013-01-12 @ 13:18

    Hello,
    Thank you for your post. This could be the right solution of my problem. BUT: what i shall do for this query: i want to show posts from category A [...]

  • Phoenix
    2012-05-14 @ 06:11

    Btw, this blog does not have a "Subscribe to comments" function, so if you respond, could you pls write to me. Thx!

  • Phoenix
    2012-05-14 @ 06:08

    Thanks Jens. After mucking about with so many WP_Query sites online, I just tried your very simple and powerful code. So tweakable!

    Question: do you know the "taxonomy" type for [...]

2

Get ID by post or page name

2010-01-16 @ 14:33

What I don’t like with wp_list_pages is that you can’t exclude or include pages by NAME. Only by ID is available. Here is the solution.

Share
  • Shaun
    2012-01-18 @ 17:13

    Really helpful! You wrote a beautiful script for WP programmers.

    Thanks
    Shaun

  • Ivan
    2011-03-01 @ 09:44

    Yes Jens! Yes!
    Are many days I'm looking for this solution!
    It was impossible to find information about what you wrote.!
    Thanks!
    From now on you have a new user who follows your website.
    Big [...]

  • 1
  • 2