A function is a sequence of program instructions that perform a specific task. It is packaged as a unit that can be used wherever the according task should be performed.

learn more… | top users | synonyms (2)

0
votes
0answers
44 views

How to get posts from network blog

So I have function that gets posts with URL(id) (ajax stuff). It works but now I would like also fetch posts from other blogs in my network. I'm baffled how can I achieve this? Do I have to know the ...
0
votes
0answers
21 views

<a>tag in register_sidebar

I use this sidebar widget between thumbnail posts. When I insert <a href="example"><img src="example2"></a> tag in widget, its size and position show post`s size and position ...
11
votes
6answers
14k views

remove empty paragraphs from the_content?

Hey guys, I simply want to prevent the creation of empty paragraphs in my wordpress post. That happens quite often when trying to manually space content. I don't know why this doesn't take effect? ...
-1
votes
1answer
27 views

How to display milliseconds instead of seconds using timer_stop function? [closed]

I'm trying to display milliseconds instead of seconds using timer_stop wordpress function. Currently I have $sbp_speed = timer_stop(0,2); That display the time like 1.56 s and I need to display ...
0
votes
2answers
27 views

How to get any tag ID

I want to exclude a certain tag from my home page not a category only post that hold the tag for example "olive"; I found a function for that which is like this function exclude_tag($query) { ...
0
votes
1answer
101 views

Get ID of first image attached to a post

I'm looking to find a solution that enables me to get the ID of the first image attached to a post in the loop. I'm currently using this; $size = 'post-thumbnail'; // Define image_size to be used ...
0
votes
0answers
2k views

java script error Uncaught SyntaxError: Unexpected token ILLEGAL

i had a website that was working fine on localhost without any errors but after i uploaded it on the domain the slider stoped working and i got this errors Uncaught SyntaxError: Unexpected token ...
0
votes
0answers
15 views

Looping through a custom query makes WordPress assume another template [duplicate]

I am calling this code from my custom sidebar, in order to get related postings from the same category: query_posts(array( 'cat' => get_category_id(), 'showposts' => 5, 'post__not_in' ...
0
votes
1answer
93 views

if && problems with transition_post_status

I'm attempting to get this function to work and it seems to not work when put together. When I just have $new_status == 'publish' it works, when I use just the second it also works. When I ...
0
votes
1answer
94 views

Right way to update widget on dynamic new input field

I have code to add an input field dynamicly in my theme. I have testd it, as a metabox and it works. But, not in a widget. First add and update, that codes work, but when I refresh page or try to ...
-3
votes
2answers
45 views

What function does the loop of displaying posts?

What is the function that does the echoing of posts like post title in h1 and then the post body and then the author name. I hope everyone understood what I'm trying to say else please ask in comments ...
0
votes
1answer
55 views

New checkbox in custom widget isn't saving data

I'm trying to develop my own widget. Mostly cause I want to understand Wordpress functionality (yes I'm completely new. First ever try to extend wordpress) I want to add a function to display post ...
0
votes
1answer
136 views

Linking Javascript in functions.php file

Below is my raw javascript embeds from my html template. But I cannnot figure out exactly how to add it to my functions.php file. It seems pretty difficult. Can you please assist with the correct ...
0
votes
3answers
48 views

Permission functions within wordpress

I'm currently developing a website and am exploring all possible options to restrict file viewing. I'm trying to find a way where I can load php files like my theme-options.php and cpt.php without ...
0
votes
0answers
59 views

Creating Content for Custom Tab in WooCommerce

I'm working with a set of three products in WooCommerce, each of which is made up of multiple "items" (custom post types). These are linked to the product using a relationship custom field. In my ...
1
vote
1answer
94 views

Conditional tag is_page with a custom post type

Accordingly to the is_page documentation, supplying the slug as an argument WP can tell me whether the current page is the one represented by the slug. Perhaps I am using the wrong slug? However I ...
1
vote
2answers
51 views

Detecting classes, adding widgets, and adding divs in with a Nav Walker

I've been trying to figure this out for days, to no avail. A template I'm building requires a mega menu. The markup for the menu looks like this: <nav> <ul> <li><a ...
0
votes
1answer
57 views

Wordpress function to add text

I m using this simple function to add text to my wordpress site post ! add_filter( 'afip_new_post_content', 'myprefix_change_afip_post_content', 10, 2 ); /* Grabs the image source for the newly ...
1
vote
2answers
86 views

Define custom Page Template without its own .php file

Is there any way of defining a Page Template from some function/filter/hook, without having any .php file containing the comment at the top of the page to declare the Template Name? For example, ...
0
votes
1answer
86 views

How to disable controls in theme customizer?

Edit: I have rewritten the question in hopes I will get a reply from someone who knows the theme customizer. I am trying to figure out how to disable setting controls in the Wordpress theme ...
4
votes
2answers
747 views

Prevent publishing the post before setting a featured image?

As the title says , I want a plugin/function to prevent/inform the user when he tries to publish the post without setting the featured image. ANY HELP ???
13
votes
3answers
2k views

Where do I put the code snippets I found here or somewhere else on the web?

Many posts here or somewhere else contain code, but they do not say where to put it. Example: I have found this post: How do I turn off 301 redirecting posts (not canonical)? I'm a newbie with PHP. ...
1
vote
2answers
98 views

Date archives for custom post type

I have seen many questions/posts regarding this, but have yet to find a decent solution. Basically I am trying to do what wp_get_archives does, but for a custom post type (personally I am unsure why ...
-2
votes
1answer
43 views

Get my site session in wordpress?

I am using a custom site build in zend frameword, i also have a wordpress installed in this directory, for example: www.mywordpressSite.com // here is my wordpress site.. ...
0
votes
0answers
44 views

Remove entry content from homepage index with infinite scroll

I have a WP theme (built on top of Genesis) and I'm having a problem with posts that are loaded on the homepage index with infinite scroll. Essentially, I'm only showing the article title, date, ...
0
votes
1answer
34 views

the_widget() inside functions.php

I'm setting some options in the backend using functions.php and I'm doing: $w = the_widget('My_Custom_Widget'); but I don't get any output. However doing <?php the_widget('My_Custom_Widget'); ...
0
votes
2answers
46 views

Entirely Different Functions.php per Page?

Is it possible via conditionals to load entirely different functions? i.e in the functions.php you have a conditional that loads in an include for the old functions, then another that loads in the ...
1
vote
1answer
27 views

Make parent page only link to first subpage

I'd like to automatically make any parent page link to it's first subpage if it has one. Like so: Parent 1 (/#subpage-1) Subpage 1 (/#subpage-1) Subpage 2 (/#subpage-2) Subpage 3 (/#subpage-3) ...
0
votes
1answer
601 views

Log in / Log Out Custom Button

On our website we have a "Join" button in the top right corner and a log in / log out link using <?php wp_loginout(); ?> . Instead of having the log in / log out link we would like to have it ...
0
votes
1answer
86 views

Help with my first Metabox helper class

I'm working on a metabox helper class and everything works well, but the radio image field. The images show up, but they aren't clickable. // Print radio_image input. private function ...
0
votes
0answers
22 views

Conditional within a public function within a loop

I am using a plugin to build widgets that includes images. Unfortunately it doesn't allow me to resize the images. I tried by adding a conditional but since it's in a public function and within a ...
0
votes
0answers
107 views

Check if values exists DB

I am getting nutts with this one. I want to check if the email introduced in the form already exists in the database before creating a new record. But for some reason the email is empty at search ...
0
votes
1answer
74 views

Error with function in functions.php?

I am using the below function in my custom theme to load posts via AJAX. But for some reason it is breaking the WP ADMIN WIdget Drag and Drop and also showing the White Screen of Death when I uploaded ...
0
votes
2answers
1k views

Only show category to certain user levels without plugin

I'm building a site for some army guys to share photos, and one thing keeps stumping me. They have some photos that they'd like everyone who is signed up for the site to view, and others that just ...
3
votes
1answer
1k views

How to paginate the get_users function?

Im using the get_users function to show a custom list of users on the site. The only issue Im having a problem figuring out now is how to paginate the result. This is a sample of the function that Im ...
0
votes
1answer
30 views

How can I alter this code to accept a slug as well as an ID?

This code is from the codex. /* == If In Parent Category... ==============================*/ if ( ! function_exists( 'post_is_in_descendant_category' ) ) { function ...
0
votes
1answer
38 views

Split Media Queries in different files!

I woke up this morning with a thought. Is it a good idea to split the different media queries in different files, check the width of the page in functions.php and then with an IF call the "correct" ...
0
votes
2answers
63 views

Logout hyperlink within a sub-menu

I have the following secondary navigation menu on my website which has been built using the native WordPress Appearance > Menus feature: I am also using the following lines of code in my ...
0
votes
0answers
30 views

Expire a post with meta_value after two weeks

I am trying to use the below code to query for some posts and then change a meta_value in order to "expire" it after two weeks time. I can't get this to work and it's difficult to test since I can ...
-1
votes
4answers
59 views

Simple Wordpress function / plugin to redirect a site

Is there a way to create a simple function that redirects every page of a site to another site? I've Googled around but all the plugins / functions that I've found are only really meant for ...
0
votes
1answer
148 views

Strange error from functions.php files (wp_register_script)

I'm trying to migrate a wordpress site, and I'm receiving this error when debugging on the new server: Notice: wp_register_script was called incorrectly. Scripts and styles should not be ...
0
votes
0answers
38 views

Widget editor not displaying in Dashboard

I'm not sure if this is because of the new 3.9 update, because I haven't had to mess with any widgets in a while, but my active widgets won't display in the editor anymore. I've uploaded a screen ...
0
votes
1answer
71 views

current_page_item is missing inside wp_nav_menu

I'm using the function wp_nav_menu like this: <?php wp_nav_menu( array( 'container' => false, 'echo' => true, ...
0
votes
1answer
44 views

Declare a function before plugin does on the theme functions.php file

I'm working with a plugin that declares a function using this format: if (!function_exists('ABdevDND_get_current_post_type')){ function ABdevDND_get_current_post_type() { ... } } I'm ...
0
votes
6answers
5k views

How to style current page number (wp_link_pages)?

When a post is split on more pages TwentyTen theme use the native function wp_link_pages to display a navigation page bar at the end of post. I am trying to style those elements for my theme, but ...
1
vote
0answers
51 views

Configuring a meta query with multiple post types that have the same relationship on a single page

I am creating a client portal were my clients can maintain their projects and leave feedback. I have two custom post types called "Clients" and "Projects" and they each pull information from one ...
0
votes
1answer
52 views

Gravity Forms After Submission - GFFormsModel::update_lead_field_value?

I am working with Gravity Forms. This code works with a couple issues : add_action('gform_after_submission_14', 'post_contract_update', 10, 2); function post_contract_update($entry, $form) { ...
2
votes
0answers
135 views

Display a query with multiple post types and same relationship on a single page

I am creating a client portal were my clients can maintain their projects and leave feedback in Wordpress. I have two custom post types called "Clients" and "Projects" and they each pull information ...
0
votes
1answer
58 views

Deactivate a plugin on wp version

I've creating a theme options page at the moment and was playing around with this function deactivate_plugins() I'm running wordpress 3.8.3 so running this code in my plugin should uninstall it. ...
1
vote
1answer
49 views

Wordpress function/template tag to get first n words of the content

OK, this might be a duplicate, I was just unable to put my idea in proper search terms, sorry for that! Is there a built-in function or template tag to get the first n words of the content? I mean ...