Tom Morton
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: pretty permalink is invalid show 404 page.+1 Thanks @pothi!
Forum: Developing with WordPress
In reply to: Hide meta if emptyMiran,
Glad I could help! Be sure to mark the thread as resolved so the administrators know your question was answered.
Tom
Forum: Developing with WordPress
In reply to: Hide meta if emptyMiran,
You’re definitely on the right track, but need a few tweaks:
<?php if ( ! empty( get_field( 'lieu' ) ) ) { echo '<span class="element-fiche-technique">Montant DH</span><span class="info-fiche-technique">'.get_field("lieu").'</span>'; } ?>
- Be careful when using ‘ and “. You need to make sure they’re standard quotes and not curly quotes.
- You used
echo
and then tried to output PHP (<?php the_field() ?>
). When you are inside PHP, which is anything between<?php and ?>
you should not wrap your PHP code. - You are outputting HTML, and you can embed the PHP function inside it by ending the string (I use a single quote and then a dot to concatenate the PHP function get_field).
- Finally, remember the function
the_field
automatically echo’s out the value. In your case, you are already using echo, so you want to return the value by usingget_field
.
Hope this helps. For further reading, I definitely recommend running through the W3Schools PHP5 Syntax and basics course. It’s quick and will really help in these situations.
https://www.w3schools.com/php/php_syntax.asp
Good luck!
Forum: Fixing WordPress
In reply to: A plugin that auto inserts code into the theme Header.php file?The
wp_head
action would be your best bet, and you could create a quick plugin that does what you need, but it sounds like you’d like this feature without having to write any code.I did some quick searching and found https://www.ads-software.com/plugins/header-footer/. Not sure if this is the same plugin you are referencing (and if it is, my apologies) but it seems to hook into
wp_head
andwp_footer
to insert the code you post inside the options panel.Note: I haven’t used this plugin. Always backup your site before installing something new.
Hope this helps!
TomForum: Fixing WordPress
In reply to: pretty permalink is invalid show 404 page.Nginx can be tricky when configuring for WordPress. WordPress expects apache and so it loads permalink settings into a hidden file inside the root HTML directory called
.htaccess
. This file contains settings for Apache to use, including how to redirect based on your sites permalinks.With Nginx, however, you’ll need to do this inside your Nginx configuration. I’m unsure where the config lives on Centos, but look somewhere inside of /etc/nginx/. Be sure to edit your site settings, not global Nginx config.
You’ll need to pass along the location and redirection settings to the file, similar to this:
location / { index index.php index.html index.htm; try_files $uri $uri/ /index.php?$args; }
Check the sources below for a bit more detailed information. I would also recommend following the www.ads-software.com Nginx link for more configuration options.
Sources:
Hope this helps and let me know if you have any follow up questions!
Tom
Forum: Developing with WordPress
In reply to: Hide meta if emptyMiran,
I see you are using a function called “the_field”, which comes from Advanced Custom Fields. I’m assuming you are using that plugin (but please confirm).
If you need to check if the meta value exists, you can use the following code:
<?php if ( empty( get_field('montant-dh') ) ) { echo "vide"; //value is empty } else { echo "pas vide"; } ?>
A few notes:
- Using “the_field” echo’s the value, which outputs it to the screen. When working with if statements, you want to return the value, which allows you to review it. In your case, you want to return the value to the empty() function to see if it’s available.
- In your code, you used square brackets
[]
instead of parenthesis()
. Anytime you are calling a function you should use the formatfunction_name(parameters)
. - Be sure to use the code above inside of the loop. The function
get_field
is anticipating the post_id will be provided. If you aren’t running it in the loop, you can use this:get_field('montant-dh', INSERT_POST_ID)
(you should place the post id inside the function where I put the placeholder.
If you have any questions don’t hesitate to ask.
TomForum: Plugins
In reply to: [WooCommerce] The woocommerce_get_shop_coupon_data filterNot sure if you already found the answer, but I was able to find this:
Helped a great deal! Hope it helps you.
Forum: Plugins
In reply to: [WPSocialite] Pinterest Pin It Button Loading IssueSorry to hear you both are having issues.
Have you updated the plugin or WordPress recently?
Tonny, can you post a link to your site so I can see it working live?
Forum: Plugins
In reply to: [WPSocialite] Local languageSorry for the delay.
Can you submit a link to where this is happening? I’d like to take a look at your site.
Forum: Plugins
In reply to: [WPSocialite] Formatting issueMark,
Sorry for the delay.
Try adding #main rather than .entry-content:
#main .wpsocialite.small .twitter-follow.socialite-loaded { width: 260px; }
Forum: Plugins
In reply to: [WPSocialite] Disable WPSocialite on Specific Posts or PagesJeremy,
There is a way, but it would involve placing wpsocialite into the template directly. Is that a method you’re comfortable with or would you rather see a button on each post/page that says “do not show wpsocialite”? Let me know your thoughts.
Forum: Plugins
In reply to: [WPSocialite] WPSocialite conflict with Responsive designValleyjays,
Are you still experiencing this issue? I’m going to mark this as resolved for now. Let me know if you’re still having trouble.
Forum: Plugins
In reply to: [WPSocialite] How to wp_enqueue socialite.pinterest.jsYou will need to re-enqueue pinterest as well as wpsocialite.js
So when you load wpsocialite.js, you need to also load extensions/extension.pinterest.js
Forum: Plugins
In reply to: [WPSocialite] Problem with facebook dialogue boxSorry for the issues and delay. Incorporating the fix into the next release.
Forum: Plugins
In reply to: [WPSocialite] Dutch translation completed!Melroy,
Sorry for the late reply! Is there any way you can include this in a Git branch over at our github page? If not, I’ll include it manually and make sure to mention you in the log.
Let me know if its possible.