Questions tagged [php]

For questions about the server-side programming language that the WordPress core, plugins and themes are written in. Questions about using PHP outside a WordPress context are off-topic but might be asked on Stack Overflow.

Filter by
Sorted by
Tagged with
0
votes
4answers
9k 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 ...
0
votes
2answers
3k views

Resize Image without cropping

Currently I’m working on a WordPress plugin and as part of it users can upload Images. What I want to do is that these uploaded images of any size will be resized to 100px by 100px without cropping. ...
0
votes
1answer
505 views

Changing Link Attributes for Wp_Link_Pages

I'm wondering if there is any way to change the actual link itself for wp_link_pages. So right now, I have a simple code to display the pagination for a post, it looks like this: <?php ...
0
votes
2answers
150 views

JS completely stopped loading but Files are found

Basically I've enqueued all of the files I need and can see there been picked up in the browser but for some reason none of them seem to load or function correctly and I get no errors in the console. ...
0
votes
1answer
3k views

How to send “Location” header on plugin form submit event?

How to redirect to specified page after form was submitted? Warning: Cannot modify header information - headers already sent by (output started at wordpress\wp-admin\menu-header.php:94) in ...
0
votes
1answer
6k views

Handling an Ajax form submit

I am developing a wordpress plugin that will create a contact form and then submit the details through an ajax request. jQuery.ajax({ type:"post", dataType:"json", ...
0
votes
1answer
189 views

Infinite-Scroll Plugin and Jetpack Infinite Scroll Plugin - Adding to “Thoughts” Theme

How do I enable infinite scroll (either with the infinite-scroll plugin OR the built in infinite scroll jetpack) on the "Thoughts" Wordpress theme? I'm a total noob at editing this stuff so if you ...
0
votes
3answers
265 views

How can i display 3 post types in same page?

How can i display 3 post types in same page search results. http://cinema.trancelevel.com/ For example i have post_type1-Movies post_type2-Trailers post_type3-Subtitrari Wen i search i want to ...
0
votes
2answers
485 views

Understanding WordPress child theme custom JS loading

After hours and hours of trying i can't get my head around it, I'm trying to wp_enqueue_script my custom js but WordPress is always looking for it in the parent theme folder, here is what i have tried ...
0
votes
2answers
681 views

Looking to exclude blog posts from category Previous/Next buttons

I'm working on some conditional elements here and I thought I had it but it's still not working right. You can see my site here. What I've done is displayed only category Legal Libation Columns (98) ...
0
votes
1answer
35 views

Need help on Wordpress and php

A friend of mine asked me to make a few minor modifications on his website (change Titles on each page, add a clickable mobile link for phone number, add business hours in the footer, add scrolling ...
0
votes
1answer
911 views

Strange switch_to_blog() issue

OK, so WordPress has been destroying me this afternoon and this particular issue I really can't figure out. We are building a multisite network and for our particular purpose need to loop through each ...
0
votes
1answer
56 views

How to save the checked boxes?

What i am trying to achieve is this I have created a custom post(offer), i have another custom post created (listing). I want to add a metabox in listing, which will recieve check list of all offers ...
0
votes
1answer
824 views

Config apple-app-site-association file with wordpress

I’m trying to implement iOS Universal Links, I need to serve an apple-app-association file at the root of my WordPress. How could I serve my apple-app-association file with application/json content ...
0
votes
1answer
67 views

How do I add a php statement to a jQuery string

I want to insert a php statement into a jQuery String to update the user profile dynamically. Here is my not working code so far: jQueryVarWP("#kreis1").append("<option value=\""+array_list[i]+"\"...
0
votes
2answers
2k views

Routing a custom php on wordpress

I am a Laravel developer that is learning WordPress. I have written some PHP code which displays some tables and some HTML and some get forms. At the minute I require the file on the index page in ...
0
votes
1answer
97 views

How to get the term before the last from a custom taxonomy?

This code displays the last term added to a taxonomy "issue" which i use to automatically display a link toward my current issue: $args = array( 'hide_empty=0' ); $terms = get_terms( 'issue', '...
0
votes
3answers
169 views

get_the_content if it contains multiple lines it results in SyntaxError

I use get_the_content to pass to a javascript variable, and then back to another PHP function. This works great, but there is an issue when using get_the_content. If the post contains only one line (...
0
votes
1answer
35 views

Print html when custom field has value inside while loop

I want to print a block of HTML only when get_field('cennik_title') has value assigned to it inside the loop, when there is no value inserted inside the custom field, the block should be skipped, but ...
0
votes
0answers
382 views

Install will not load: PHP does not have MYSQL installed

I'm having trouble installing Wordpress on my Windows 2008 R2 server. I'm getting the message: Your PHP installation appears to be missing the MySQL extension which is required by WordPress. To ...
0
votes
1answer
489 views

Wordpress returns a wrong date

I am trying to get the todays date , day and time . Today is : 10th july 2018,tuesday and time is 3.23am For time the below code works fine: $wpplcurrenttime = current_time( 'g:i a', $gmt = 0 ); ...
0
votes
1answer
399 views

How to check for WordPress timezone type?

If you choose a city as a timezone it will save to the "timezone_string" option but if you choose a Manual Offset (UTC+1 for instance) it is saved to the "gmt_offset" option if you need the ...
0
votes
2answers
639 views

How to place login logout link on menu that redirects users back to current page?

I am working on an area of my site for members. However, I need a link on my menu that when clicked it will take people to my login form then back to the page they were previously on. I need the same ...
0
votes
2answers
272 views

Show only one post for each author ( Page loads too slow )

I want to show only one latest post by each author and found this code that it working. However, it takes too long to load the page since I have over 100K authors and 100K posts in database. How can I ...
0
votes
1answer
6k views

Can't Find a Way to Edit the Home Page Content [closed]

I'm working on http://www.boldtiger.com and I can't find out how to edit the home page. The previous developer on the project has disappeared, and the site owner and I have had zero luck contact him. ...
0
votes
2answers
33 views

category not display in word press grammatically

I'm trying to create a new category in the taxonomy.php called 'USSERS'. I have followed few examples online and got till this part. function insert_term( $name,$tax,$parent='' ,$slug='') { $...
0
votes
2answers
1k views

How to use a frontend URL with a Plugin

I want to use a URL to display content in the frontend. For example domain.tld/?myplugin&confirmey=KEY&mail=MAIL But i don´t know the way(s?) to do it. For example i have a user that clicks ...
0
votes
1answer
286 views

Adding Image Count to Multigallery

Ok so I am using the [multigallery] function and it works fine, but one thing I want to add. Here is the code that I am using for the multigallery in my functions.php file function ...
0
votes
2answers
718 views

Show last 5 posts from specific category

I'm trying to show the last 5 posts from a specific category, which will be linked to a function so i can insert the shortcode in a Wordpress page. The code i have is as below, it does everything i ...
0
votes
2answers
221 views

Wordpress theme & site not loading after moving files

I was recently created a custom application for wordpress. So while doing so in my file manager (I use the one provided by godaddy(my webhost)), I moved all the files from the [DOCUMENT_ROOT] ... the ...
0
votes
1answer
54 views

How to Remove a Filter from the Admin List Table?

I don't want the "Registered customer" filter option for the Admin Orders page. I have tried to search for how to remove it. I have been inside the WooCommerce codes to see how it's implemented. And ...
0
votes
1answer
1k views

TCPDF get_post_meta outside the loop

I want to be able to export a html page to PDF. I downloaded TCPDF (mainly because it allows me save High resolution images and shrinks the filesize.) The TCPDF folder is in my theme folder. If a ...
0
votes
1answer
93 views

How to Populate the list of custom post type categories

Default categories are populated like this → <?php if( $terms = get_terms( 'category', 'orderby=name' ) ) : // to make it simple I use default categories echo '&...
0
votes
1answer
61 views

How to add 2 posts under another post? Formatting should be intact

The goal is to print 2 articles under an article IF the article is 200 words or less. I've had some help over at WordPress, but the code a couple of helpful people provided I can't integrate into a ...
0
votes
1answer
662 views

display most popular tags in two columns

I have a section in my sidebar where I'd like to display my most popular tags in two columns. I found this post from WPSnipp that details how to narrow your list down to only the most popular, however ...
0
votes
1answer
1k views

Why does “get_option” pull in the older value in options.php, rather than the newer value, on submission of a form?

I'm building a simple post order "plugin" through my theme's functions.php. The function updates the value of an option in options.php on submission of a form. So, for instance, when "1" is inputted ...
0
votes
0answers
86 views

how to display active, upcoming and past event with featured listing with pagination

I have a code that work fine for Active Events Page, Upcoming Event Page & Past Event Page with a event_start_date later than today. What I want is? A : To show Active, Upcoming, Past event post ...
0
votes
1answer
271 views

Twitter feed is showing blank in WP site [closed]

I am using themefuse WP theme and facing this problem. http://themefuse.com/forum/thepractice-wp/twiiter-newsline-is-blank Can someone please suggest if I need to use some other attribute. I am not ...
0
votes
2answers
720 views

Nice scroll to wordpress

I am converting html5 to wordpress Theme. I want to use custom scroll for wordpress. The code DEPENDENCIES It's a plugin for the jquery framework, you need to include jquery in your scripts. I will ...
0
votes
1answer
2k views

Why is PHP Cookie via plugin only set when logged in as Admin and not regular users? and other questions

At first I thought it was a browser issue, but it looks like my code only sets a cookie if the user is logged in the administrator. If you are not logged into the Administrator account then it does ...
0
votes
1answer
696 views

Enqueue less file not working in child theme?

In my child theme I have: add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style....
0
votes
2answers
2k views

Multiple pages on one with different HTML

I am a bit confused on how this may be achieved. I have a website that I have coded already with static HTML/CSS and I am trying to incorporate it into wordpress. The challenge though is that the ...
0
votes
1answer
616 views

Exclude pages with certain template from wp_list_pages

Before you mark this as duplicate I have tried every method in all the other questions and non of them have worked. I am trying to exclude any page with the page template page-noindex.php from the ...
0
votes
2answers
229 views

Seriously stuck with some custom meta box/plugin stuff

I’m working on a small plugin - part of it needs to add several meta boxes to all custom post types. I’ve tried looping through my array of custom port types in various ways but I keep getting errors ...
0
votes
1answer
96 views

Add/echo div with Analytics-Code to function in functions.php

I want to do something special I think. I need to add a html-snippet with GA-Code to a function in functions.php. To do this I thought to add this piece of code: echo ('<div onClick="ga('send', '...
0
votes
1answer
6k views

Index showing source code

Suddenly the wordpress showing the source code when I click the url address, and I get this The code is just the site offline plugin i have so i can set the site offline So the problem is that ...
0
votes
2answers
9k views

Display all posts in current category

I am looking to create a behavior as shown in the following link: http://www.javaexperience.com/java-role-of-serialversionuid-in-serialization/ Here all posts from the same category are being ...
-1
votes
1answer
28 views

explanation for activate_plugin function in wordpress core

This function is in plugin.php file in wordpress core. I read the code and didn't get quietly what does it do. Can anyone give some explanation for this function?
-1
votes
2answers
628 views

shortcode doesn't work

I made my first WP plugin, it is a contact form - here is the code: <?php /* Plugin Name: Example Contact Form Plugin Plugin URI: http://example.com Description: Simple non-bloated WordPress ...
-1
votes
1answer
48 views

show limited tags in an article

I have a code that returns all the tags for the article. But that is not what I want, I only want to return the author name as the tag. <?php the_tags() ?></span> <br /> This will ...