0
votes
0answers
49 views

admin-ajax.php not working after wordpress 4 update

n WordPress 3.9.2 access to admin-ajax was working for non loggedin users. When I upgraded the script stop working. I have the following code in functions.php function theme_name_scripts() { ...
0
votes
0answers
24 views

Send post id through ajax and get the post content back

First of all i want to say that I am a WordPress beginner :). I am trying to get a post content in a modal by using ajax. So i send the id through ajax, but i cannot execute the php code anywhere on ...
0
votes
1answer
46 views

Allow the access over wp-login.php

I created a maintenace template, and redirected to the folder where it is located via the functions.php file inside the theme folder; this is the code: function maintenance_redirect(){ if( ...
0
votes
1answer
161 views

How to set global variables in template page?

I know this works. In functions.php do: $variable = "value"; and in header.php use: global $variable; echo $variable; Is it possible to set a global variable in template page or include php ...
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
212 views

How to extract the variables out from “add_shortcode” function?

In Wordpress, lets say i have a custom Shortcode function, like: function foobar_func( $atts ){ //whatever required processings here... $foo = "the value is foo!"; $bar = "the value is ...
0
votes
0answers
49 views

wp_list_bookmarks(); not displaying anything

Bizzarely, I can't get the wp_list_bookmarks(); function (inside a page template) to render anything. Hope somebody can point out something obvious! Cheers. Here's my code: <?php /* Template ...
0
votes
0answers
59 views

How to: Get the first image from the next and previous post in single.php? (5 posts)

I know I can call a function below but it works in loop at index.php only. function catch_that_image() { global $post, $posts; $first_img = ''; ob_start(); ob_end_clean(); $output = ...
0
votes
1answer
80 views

Add Element as a Filter to the_content

Can I and How would I add a filter in the function.php that would add a HTML element around the content when the_content is used? This would be similar to what you can do with the_title. i.e: ...
0
votes
1answer
65 views

Shortcode to output get_header not working

I'm trying to create a shortcode that will output the contents of one of my template header files. I created the shortcode in my functions.php file function zoo_header(){ return ...
3
votes
2answers
100 views

When is it appropriate to put functions on page template vs. functions.php?

I'd like to improve my code and on a current theme, I've extended Wordpress with custom post types, metadata, customized user authentication, and a number of other items. Some of these functions ...
6
votes
1answer
160 views

How to redirect to post if search results only returns one post

I want to send visitors to my search.php after a search to display list of posts. If there is only one search result, user can directlyto the post in question(something like GOOGLE's I am Feeling ...
0
votes
2answers
37 views

Show admin page, only if function is being used

I wrote a small function which displays a quote on the page, whenever the function is being called somewhere in a template. Since nobody likes the same quote, I created an admin page for it, where one ...
0
votes
1answer
149 views

Fatal error: Call to undefined function the_ratings_results()

I was wondering if I rack your brains a bit on this one. I have a custom theme that has files in the theme folder but do not load as wp template files on the page settings. I also run EDD (easy ...
2
votes
1answer
35 views

Returning Variables back into a template

If I put a function that I want to use in a template I can put it into functions.php function myfunction(){ echo 'My String'; } add_action('myfunction','myfunction'); and in a template file put: ...
-1
votes
1answer
109 views

How can i hide content if not friend in Buddypress? [closed]

How can I hide some specific contents or div or other stuff depending on being friend or not in buddypress ?? I tried to use the bp_is_user_friends() function but it did not work !
0
votes
1answer
286 views

Some problems calling a function into sprintf() inside functions.php template file [closed]

I am new in PHP and WordPress and I am personalizing an existent template and I have the following problem. In the function.php file of the template I have the following function: function ...
0
votes
1answer
144 views

Overwriting TwentyTwelve template file with child theme template, but lower in the hierarchy

I've (I think) an interesting problem here. What I want to do is create a global archive page, with everything on it. Dates, authors, categories etc all on one page. I have a child theme, with ...
0
votes
1answer
196 views

Prevent creating multiple image resizes in twentytwelve template

I am using wordpress twentytweleve template and I notice every time I upload an image it creates 3 different thumbnail sizes. In my media settings I have already set medium & large size to 0. It ...
0
votes
2answers
145 views

Using locate-template & shortcodes doesn't appear to work

For organisation, I'm trying to split up the functions.php file into separate files. In particular the functions for shortcodes in a separate file, with the shortcodes being defined in functions.php. ...
0
votes
1answer
3k views

Add a Second Menu to a theme that only support 1 menu

I am no programmer but I can usually work stuff like this out when I read the code. I have a theme called Infinity which only supports 1 menu. I know how to do CSS etc but I can't find how I would a ...
0
votes
1answer
393 views

Replace single_template filter with what for default posts?

I was going through a tutorial on Justin Tadlock's blog but it uses the single_template filter, which was removed in 3.4. The codex says to use {$type}_template but if I use "post_template" with the ...
1
vote
1answer
674 views

Passing variables to templates (alternatives to globalizing variables)

I want to make my WP code simpler (there's some mess within header.php, page.php etc.). So, for example, I want to set something like this global: $foo = get_option('foo'); So $foo will work ...
0
votes
1answer
437 views

Function to allow single post template based on custom taxonomy?

I'm trying to use Justin Tadlocks function for category specific custom post templates, but have become stuck when trying with a custom taxonomy, as his examples only have normal categories. Can this ...
4
votes
1answer
2k views

wp_get_attachment_image returns different image size

It is a bug? wp_get_attachment_image( $attachment_id, 'post-thumb-size-small'); Same code, called in template, and in AJAX call returns same image SRC, but different image width and height. dumb ...
1
vote
1answer
2k views

Default Gallery Edit/Template Editable?

I quite like the default WordPress Gallery, but i dont like how it plonks the images as thumbnails, with a link to the larger image. Is there anyway to make it display the images not in a thumbnail ...
0
votes
3answers
111 views

Best way to handle lack of titles in microblogging

I'm experimenting with doing "microblogging" with WordPress and I'm doubtful about how to handle "titles" when one uses different post "formats" (the "formats" may or may not be related with the core ...
2
votes
1answer
1k views

Make “sidebar template” the default template for new pages

On Twenty Eleven or on its child themes the default template for new pages is a template with no sidebar. I don't know why this is like this; it seems to me that the designers of Wordpress are still ...
0
votes
1answer
2k views

Simplest Way to Build Custom Archives Page?

I am looking to create a page in Wordpress to output links to all of our posts from every month since we launched the blog. I have seen the archive.php template file in Wordpress, but this seems to ...
2
votes
1answer
61 views

Adjust which tempalte a page uses with a function?

I know if I had a page that had a permalink such as /stories/ then I could create a page in my template called page-stores.php and it would load in place of the default page.php when that page loaded ...
1
vote
1answer
686 views

Custom excerpt function re-factoring

This may be more of a php best practices question, but here goes... I am using a custom excerpt trim function: function new_wp_trim_excerpt($text) { // Fakes an excerpt if needed global $post; ...
3
votes
3answers
3k views

How to fix a theme with page.php Default Template that accidentally deleted?

I am having a quite odd case with WP today, and after spending about an hour searching on google and forums, can't find any answers. I hope posting here might allow me some chance to get help from ...
0
votes
1answer
3k views

attachment page template? only show attachments for current post?

hey guys, didn't know that, but the attachement page (i'm using attachment.php as template) is actually looping through ALL ever uploaded attachments to my blog! I just want to use it in order to ...
0
votes
1answer
730 views

Conflict in function to allow single post template based on category

I've used Justin Tadlock's great function for category specific custom post templates many times, where you can use single-cat-id.php for single posts belonging to a specific category. I just ran into ...
1
vote
1answer
512 views

Toggle Sidebar Display

I'm developing a WordPress theme that allows users to toggle the visibility of the sidebars using Javascript in the same way that wikis allow users to show or hide a table of contents. When a user ...
3
votes
2answers
831 views

Modify CSS via Theme Control Panel

Hi to all I'm trying to create an advanced control panel for my first Wordpress template but I'm not able to add a function that I will need. The function that I'm trying to add is the possibility to ...
0
votes
2answers
183 views

Function Reference Documenting Template Tags for use in Custom Theme Templates?

(Moderators Note: Original title was "custom template / wordpress functions?") I'd like to use a modified WordPress theme template and was wondering where I can find a reference for the .PHP ...
1
vote
3answers
2k views

Load post with a different template?

Let's say I have a single.php file with a certain layout (graphic intensive). I want to create a sort of plain-text version of the same page that is only called when the user clicks the provided ...
0
votes
1answer
486 views

Run a jquery script on on a certain template page

All I want to do is basically this: wp_register_script( 'jquery_zebra', get_bloginfo('stylesheet_directory') . '/library/scripts/jquery.zebra.js', array('jquery')); wp_register_style( ...