Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all 8245 articles
Browse latest View live

deseosuho on "Javascript 'Hello World' in page template"

$
0
0

I'm trying to migrate a functioning web app into my wp site. After reading the using javascript codex, I still haven't been able to get a simple 'hello world' script to run.

I created a new wp template page with the following php:

<?php
function my_scripts_method() {

	wp_register_script(
		'jsexample',
		get_template_directory_uri() . '/js/jsexample.js' );
	wp_enqueue_script('jsexample');
}
add_action('wp_enqueue_scripts', 'my_scripts_method');
?>

<!-- start site content -->
<script type="text/javascript" src="<?php get_template_directory_uri(); ?>/js/jsexample.js"></script>
<?php echo get_template_directory_uri() . '/js/jsexample.js'; ?>

the echo statement shows me that the url for the script is valid. However for pages based on this template, the javascript file, which simply contains alert('Hello World'); does not run. What am I doing wrong?


Jens on "Plugin shows up twice"

$
0
0

Hi there,

I wrote a small little plugin.
Today, I added a setting page and updated it.
Problem: The plugin shows up twice in the plugin overview. One is active, one is inactive. If I delete one of them, they both disappear.
It seems like this is based on some bug in my plugin code.
Is this a known problem. Do you have any idea where I need to look at?

The plugin: https://wordpress.org/plugins/add-full-svg-support/

Thanks in advance!

Best,
Jens

ciderfield on "htaccess file corrupt"

$
0
0

I have been having trouble with a corrupt htaccess file every since Wordpress version 4.2 has been installed....my hosting service advised that it does not appear to be a hacking issue. Has anyone experience this issue....and what are the resolutions if any?

Nunivo on "Post Counter Short Code"

$
0
0

Greetings,

I am still a greenie on PHP coding, how can i make a short code that counts the numbers of post (all post)?

Thanks

ColumbiaWebDev on "Set Thumbnails via Database"

$
0
0

So I have a ton of old posts that have images attached (via the Media Uploader) to the post content, but don't have featured images. OF COURSE, my theme wants to use featured images. :-)

I have the post_id of each post in my set. I have both the meta_id value of the image for each post and the URL of each image.

I want to just do a SQL statement/insert/update in my database backend to set all the featured images, but I can't seem to get it to work. I tried inserting the post_id, meta_key="_thumbnail_id", and meta_value=my image ID into the _postmeta table and ... nothing. They don't show up as attached on the front-end. Am I missing a step? Do I need to regenerate thumbnails or something afterward?

Any insight is greatly appreciated, thanks!

P.S. I know there have been solutions/ideas posted elsewhere about how to accomplish this with php or wp hooks, etc. I just want to update from the database side if possible...SO much less confusing for me. :-)

Charlie on "TinyMCE Custom Button with AJAX"

$
0
0

I’m trying to create a simple proof-of-concept for a custom TinyMCE button in the WordPress post editor that, when clicked, will use AJAX to send “Hello World” to the server, then get “Hello World -- GOT IT” back from the server.

I’ve got the whole custom-TinyMCE-button part working just fine. And I’ve got the AJAX send/receive working fine. But the problem is that the AJAX send/receive isn’t happening when the user clicks the custom button -- it seems to happen as soon as the page loads!

The code below is what I pieced together from a bunch of examples I found on the Web (I’m not a JS programmer!). None of the examples were exactly what I was looking for, and that’s probably where the problem lies.

( function() {
    // This code belongs in /wp-includes/js/tinymce/plugins/beacon_clean/plugin.js
    tinymce.PluginManager.add( 'fb_test', function( editor, url ) {

        // Add a button
        editor.addButton( 'fb_test_button_key', {

            text: 'Test Button -',
            icon: false,
            onclick:
		jQuery(document).ready(function($) {

		    data = {
		    	action: 'aad_get_results',
		    	data_passed: 'Hello World'
		    };

		    $.post(ajaxurl, data, function (response) {
			alert('Got this from the server: ' + response);
		    });
		    return false;
		}) // jQuery.ready function

	} ); // editor.addButton
    } ); // pluginManager
} )(); // containing function

The custom button appears in the WordPress post editor just fine; the alert box appears with the modified test data from the server just fine. But the alert box appears as soon as the page loads -- it doesn’t wait for the user to click the custom button!

What do I need to change to make the AJAX call happen only when the user clicks the button?

Thanks!

datainterlock on "[caption] 's Yet again"

$
0
0

Ok, I'm trying to write a plugin and I'm confused. I've read through the Codex and got even more confused. And other forums made it worse. Here's my problem.

I have $content. Which may or may not have a [caption] shortcode in it, as inserted by the TinyMCE when placing media. As long as I put that $content into a TinyMCE, I see the captions formatted properly. When I try to display that $content in say a table, the [caption] isn't converted to HTML

Do I need a filter, a hook, a new shortcode... I dunno. I'm using a boilerplate to create this plugin so do I add this filter, hook, whatever, and it's accompanying function into the 'construct' method or does it go into my menu?

Do I need an apply_filter on the $content? If so, where do I put that???

All I want is for the images to have their normal captions. I wouldn't have thot it this difficult and confusing.

maartenhemmes on "UserID from wp_get_current_user returns 0 in new release"

$
0
0

Hi,

It seems that wp_get_current_user() returns a 0 instead of NULL by default if no user is logged in. I can't seem to find an answer in the release notes, but it seems this changed after the release of 4.2.1.

Is this part of the new security fix?

Can somebody shine a light on this?

Thank you,
Maarten Hemmes


Serpentsoft on "Email field in comment box got a script after posted"

$
0
0

Hi there, i have some wordpress themes for 2 yrs, one of them had over 15,000 comments from spambot you know however, i decide to remove it and as curiosity i looked for email, URL and comment from (Quick Edit Comment) then i found the Email field has a script after it like

( becrusnqvsx@gmail.com/* <![CDATA[ */!function(){try{var t="currentScript"in document?document.currentScript:function(){for(var t=document.getElementsByTagName("script"),e=t.length;e--;)if(t[e].getAttribute("cf-hash"))return t[e]}();if(t&&t.previousSibling){var e,r,n,i,c=t.previousSibling,a=c.getAttribute("data-cfemail");if(a){for(e="",r=parseInt(a.substr(0,2),16),n=2;a.length-n;n+=2)i=parseInt(a.substr(n,2),16)^r,e+=String.fromCharCode(i);e=document.createTextNode(e),c.parentNode.replaceChild(e,c)}}}catch(u){}}();/* ]]> */ ),

i found all emails had this script, then after i removed all comments i tried to add a new comment and then look for new comment i found the same script added automatically after my email.

Is that a security issue in my site?? Thanks for your help.

jazib12 on "product catalog page"

$
0
0

Hi guys, i need a little help from you all. So im building a website that doesn't sell products but it shows the price catalog etc. so ive been trying to achieve a single product page with its price and catalog and installation video( will be a video from you tube) and i want it to look something like this page http://www.megamanuk.com/lightwaverf/products/jsjslw930/jsjslw930/
Help will be appreciated

D12 on "No access to dashboard"

$
0
0

Hi there,
When i try to access the WP panel for my website the login page says wrong pass and username when they are correct.
I also notice that somebody publishes posts in my blog.
When i try to reset pass the page suggests
'The e-mail could not be sent.
Possible reason: your host may have disabled the mail() function.'

So i wonder how can i get back in control?
thanks

DaniSainz on "Possible problem with custom Hooks- Wordpress 4.1.2"

$
0
0

Hello,

i have one problem in my custom Hook, i´ve updated Wordpress to 4.1.2 and the hook is down. Someone with the same trouble?

Thank you

salihkulangara on "Disappearing menu items in dashboard once the CPT post get published by Admin"

$
0
0

I have created a custom post type, say, 'Challenge'. I have also created some new user roles, on of the user role is 'evaluator', this role has capabilities some what like default 'Contributor'. The can submit for preview, the issue I am facing is, everything work fine until the Admin approves and publishes the post[from CPT Challenge], Once get published if I click on Menu 'Challenge' I dont have 'All Challenges/Add New Challenge' links underneath, and also on hover what we get that also missing. But If i Click on link 'Dashboard' and hover on link 'Challenge' there I will get Add New Challenge, I can add new challenge. I am Using 'MEMBERS' plugin to check and add Role capabilities, also i confirmed I have given all the privileges that the default 'Contributor' have through the plugin interface.

While Creating Custom Post type I have defined Capabilites, and mapped. Then what I am doing wrong, which Capability my new custom role missing??

One more thing if I add 'edit_published_challenges' cap to 'evaluator' role, every thing will work fine, but I dont wnat to do this, Once Editor or Admin approved, it should be blocked from editing by evaluator

Nithyanantham on "Same login credential for 2 sites."

$
0
0

Hi,
i am developing two site..one site is wordpress and another site is core php.I want to use wordpress login credential for core php site.If user logged to wordpress site means user can access core php site also using same wordpress session.No need of login to Core php site.How can i get the wordpress session in Core php site???pls help me...

cirrus123 on "Plugin updates"

$
0
0

I'm kind of confused about how one goes about updating a plugin once it's released. I've seen wp-updates.com, but I can't seem to find clear information on how it all works.

For example, if I distribute my plugin through wordpress.org and use subversion, do I need to use wp-updates? How do I control how users are notified about versions if I use wordpress.org for distribution?

Thanks in advance.


guymizrahi on "delete_option with button?"

$
0
0

Hi,
I hope this is the right place .
I write to my template Page Options
I wanted to know if I put something in , for example, an image I want to have a button next to it
" delete " when pressed would then jump Alert

If you click OK so I want to do
delete_option command
If not do not do anything .

I gave onclick="validate_delete" to delete
The problem that I do not know how to turn the OK from the popup to delete_option command..
( <?php delete_option( $option ); ?> )

Thank you

mindthrone on "Rewriting hierarchical post type"

$
0
0

SO, I'm having an issue where I need to rewrite a hierarchical custom post type. The custom post type is called "Destinations" and it hold regions, countries, and holidays. There is already content on the site so I can't redo this functionality.

The current structure goes 4 levels deep:

/destinations/{region}/{country}/{holiday}/
Each level has it own design type.

What I need is:

{region}/
{region}/{country}/
{country}/{holiday}/
Destinations is completely removed from the URL and the URL level are restricted to 2 levels.

Is there anyway of doing this within WordPress?

Chris Huff on "Don't trim space at the end"

$
0
0

Via my plugin's settings page, I'm trying to save a string the database that has a space at the end of the string, which I want it to have. But when it saves it to the database, it trims the space off of the end. Is there a way to tell it to keep the space at the end?

Here's some relevant code:

function afift_settings_page() { ?>

<form method="post" action="options.php">
    <?php settings_fields( 'auto_featured_image_group' ); ?>

    <p><label for="auto_image_before_text">Additional Character(s) Before Text:</label>
    <input name="auto_image_before_text" type="text" size="5" id="auto_image_before_text" value="<?php form_option('auto_image_before_text'); ?>" /></p>

    <p><input type="submit" value="Save Changes" /></p>
</form>

<?php }

chevy454 on "Facebook Photos: Embed from Stream?"

$
0
0

Anyone know how to embed any/all of the pictures posted in a user's Facebook stream? It seems the plugins I've tried either embed a single album or posts; I would like any picture uploaded to a Facebook stream/page/whatever to be added/embedded to a wordpress page.

pearlyellow on "Meta_query relation between custom fields not working"

$
0
0

Working on a site in my local environment and having trouble getting meta_query to work with two custom fields. The custom post type (opportunities) has a field (g_deadline) which is attached to a date picker and another field (g_deadline_text) is a text box. Information only needs to be filled by one of the custom fields.

If I remove the 'key'=>'g_deadline_text', only the posts with 'g_deadline' appear correctly and hides posts before todays date.

Is my idea even possible?

If I use the code below:

  • All posts show
  • The posts with custom field 'g_deadline_text' show before the date posts
  • Posts before today are not hidden
$govArgs = array(
  'post_type' => 'opportunities',
  'posts_per_page' => -1,
  'order' => 'ASC',
  'taxonomy' => 'g_categories',
  'orderby' => 'meta_value',
  'meta_key' => 'g_deadline',
  'meta_query' => array(
  'relation' => 'OR',
      array(
      'key' => 'g_deadline',
      'value' => $currentdate,
      'compare' => '>=',
      'type' => 'DATETIME'
      ),
     array(
      'key' => 'g_deadline_text',
      ),
   )
);
Viewing all 8245 articles
Browse latest View live




Latest Images