Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
2 answers
2k views

Most elegant way to enqueue scripts in function.php with foreach loop

I wonder is there a way of running wp_register_script and enqueue with the help of foreach loop to manage label and dir? For example, function wbs_app_components(){ $scripts_list=array( ...
Ezeewei's user avatar
  • 185
1 vote
2 answers
2k views

Best way to style first post differently?

I am building a custom (child) theme and I want to style the first post of my loop in a different way than the others (bigger image, different position of some stuff). Which is the best way of doing ...
Cmorales's user avatar
  • 143
27 votes
4 answers
36k views

Manually set global $post vars with an ID, in order to use template tags

I have a function retrieving ID's of posts by very specific means. I need to be able to set the global $post in order to use functions like the_content(), which does not allow an ID as a parameter. ...
Mild Fuzz's user avatar
  • 4,190
11 votes
1 answer
16k views

What is This esc_html_e() i wordpress php?

why do developers use <?php esc_html_e() >? in 404 pages, what does it mean, how does it works?
TheDose's user avatar
  • 198
4 votes
2 answers
1k views

Build a content and excerpt grid loop with paging and options for # of posts

What I'd like to do: on index.php, a loop that shows a selectable number of full posts using the_content and then below that shows a selectable number (the number of posts can be hardcoded in the ...
markratledge's user avatar
  • 8,735
0 votes
0 answers
49 views

delete an array element when its date expires

I have user levels for access content. I made a start date and end date input for each other. Each level has its own history. Whichever level date exceeds today's date, it will be removed from user ...
freedom667's user avatar
0 votes
1 answer
40 views

Custom post type loops with different page templates

My website has two different page templates. Each page template contains a different custom post type. The posts from the loops can be loaded by AJAX to load more. This is the common code that I run ...
Mathieu Préaud's user avatar
0 votes
1 answer
4k views

How to add active class to custom menu using while loop and wp_list_pages

I am running wp_list_pages through a while loop to create a custom menu. By running it through a loop I can target specific elements to show. I need to figure out how to either target the classes ...
Heather's user avatar
  • 489
0 votes
4 answers
13k views

How can I loop into two different DIVS without repeating the DIVs

I am having a little trouble trying to figure out how I can accomplish this: I have a container with two colums in it, a right and a left column. Each column will have 3 posts with a short excerpt ...
user1632018's user avatar
0 votes
1 answer
490 views

Wordpress - thumbnail image from youtube (function and loop)

Hi :D i need show thumbnails from youtube in homepage, i have a code for wordpress in function and the loop but not working thumbnail from youtube. What can be wrong with the code? Function Code: ...
user3766356's user avatar