get_avatar() as backround image

It’s hard to say exactly what the problem is with your code, but… There is at least one major flaw – you don’t pass any param to get_avatar_url, but first param for that function is required and should contain ID or email. To be precise: $id_or_email (mixed) (Required) The Gravatar to retrieve a URL for. … Read more

Display ACF if parent page has specific template

For anyone dealing with the same issue, I just needed to change: $choices[ $template_name ] = $template_name; with: $choices[ $template_filename ] = $template_name; Consider a page template Homepage (page-home.php). This way the template name Homepage will appear on the custom fields page but $rule[‘value’] will actually return page-home.php and then we can compare this with … Read more

Page with posts from category doesn’t work

So, apparently I accidently copied the comment Template Name: Portfolio to my page.php as well, so when I selected the ‘portfolio’ template wordpress just picked page.php out of the two possible templates. May be a warning for other people that have this problem 🙂

How to build a PDF repository in WordPress

Right now, the support for tagging media is pretty disappointing. You can add tags or categories to the attachment post type, but you’ll find the UI is unacceptably bad (it’s a text box where you enter terms separated by commas). There’s a plugin Media Tags that is decent though, so you might look into that. … Read more

changing background color depending on parent page

Using body_class(), by default, WordPress adds classes like parent-pageid-43 to it. This only goes one level deep, though. The code below works for any ancestors of your parent pages, not just children. It relies on the is_page_or_ancestor plugin for that. As kaiser said, body classes are the way to go. You can define the name … Read more

Custom Page Templates

archives.php is a template file that WordPress will use by default (if it exists). If you want to create a custom page template you need to create a new template file in your theme. You can read all about it in the Codex, but I’ll provide an example below. Put this at the top of … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)