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

AliceWonderFull on "punycode / IDNA converter"

$
0
0

Does WordPress already have the facilities for switching between punycode and IDNA?

http://www.phpclasses.org/browse/file/5845.html

is a pretty good class I have used in the past, I am hesitant to include it with my plugin especially if the issue is already addressed in WordPress, but also because if the issue is not addressed then I would rather advocate for the issue being officially addressed. Maybe even by including that class (it is GPL2.1)


Aubrey Portwood on "Unable to use register_activation_hook"

huynguoidacbiet on "How to disable auto url alias wordpress"

fluesey on "get_user_setting for logged out user change WP 3.7"

$
0
0

get_all_user_settings() which is used by get_user_setting now checks that user is logged in - ie get_current_user_id is non-zero - before returning anything. The single line change that makes the difference is that pre-3.7:

if ( ! $user = wp_get_current_user() )

was changed in 3.7 to:

if ( ! $user_id = get_current_user_id() )

This is a bit of a bummer as it was handy to use all the cookie stuff in utils.js before.

The workaround for me was just to copy the pre-3.7 version into my own code.

emiku on "Please Help!!!"

Jonas Lundman on "Manipulating register_post_status() setup on pageload"

$
0
0

When register custom post status in my functions.php. Can I provide diffrent args for diffrent user views? Will this type of manipulating totally be "out of how to?". Ive been searching for an answer many months, but cant se anyone doing this, so I finally have to post it here.

Here is my code:

function my_custom_post_status(){

if(current_user_can( 'update_core')) $p = true;
    else $p = false;
register_post_status('archive', array(
    'label'                     => _x( 'Archive', 'post' ),
    'public'                    => $p,
    'exclude_from_search'       => true,
    'show_in_admin_all_list'    => true,
    'show_in_admin_status_list' => true,
    'label_count'               => _n_noop( 'Archive <span class="count">(%s)</span>', 'Archive <span class="count">(%s)</span>' )
));

}
add_action( 'init', 'my_custom_post_status' );

This actually is working, but do I mess with the database or are this kind of register just a "page to page load" variables? ( I mean, "register", is it just instructions how to handle the "already stored" and "to be stored" in the database? )

Don ask why Im doing this (!), just if I can do it -or if Im making a mess...

Thanks to all of you who contributes on this forum !

darksigns on "variable in url at register page"

logicstar on "Replace some Post with custom Image when the post expired"

$
0
0

Hello Friends,
first of all sorry for my bad english, and i am newbie here

I am totally desperate here :(

I am developing theme for events, and it is using auto expiration method, when the post is expired it will be auto hide, i am following the tutorial from this site
http://j3webworks.com/blog/wordpress-make-posts-expire-or-auto-delete
and it is working like a charm.
but I want to set, when some post is expired it will be replaced with some custom image/ link.

This is what i want;
- first it shows 3 posts, when 1 posts is expired, it will be replaced with custom image no 1
- when 2 posts expired it will be replaced with custom image no 2
-when all 3 posts is expired/ not displayed at all, it will be show custom image no 3

like this;

1st posts expired -> show custom image no 1 at the bottom
2nd posts expired -> show custom image no 2 at the bottom
3rd posts expired / 0 post -> show custom image no 3

tried using post count ($count++) but it is not working

below is my code

<?php
$args = array(
'showposts' => 3,
'category_name' => 'events');

query_posts($args);
 while (have_posts()) : the_post(); $data = get_post_meta( $post->ID, 'events', true );
include (TEMPLATEPATH . '/includes/global-metabox-hook.php');
$expirationtime = get_post_custom_values('expiration');
if (is_array($expirationtime)) {
$expirestring = implode($expirationtime);
}
$secondsbetween = strtotime($expirestring)-time() - 10800;
if ( $secondsbetween <= 0 && $data[ 'autodelp'] == 'yes') {
wp_delete_post($post->ID, false);
} elseif ( $secondsbetween <= 0 && $data[ 'autodelp'] == 'no') {
} elseif ( $secondsbetween > 0) { ?>			

<div class="small-post">
<div class="date-event-circle">
<p class="date"><?php the_time('j'); ?></p>
<p class="month"><?php the_time('M'); ?> </p>
</div>
<div class="small-post-detail">
<?php if($meta_gallery){ ?>
<?php foreach ( $meta_gallery['docs'] as $img ) { ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" >
<?php $thumb_img = $img['imgurl'];?>
<img  class="home-event-thumb" src="<?php bloginfo( 'template_url' ); ?>/timthumb.php?src=<?php echo $thumb_img; ?>&w=728&h=340&zc=1" alt="" />
</a>
<?php } ?>
<?php } ?>

<h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" ><?php the_title(); ?></a></h3>
</div>
</div>
<?php } else { ?>
<?php } ?>
<?php endwhile; ?>

hope my explanation is clear
help me please :)


alev on "Any one know how"

$
0
0

Hi
I made changes in General Settings
replace ip address the was used during site design and development
with real site url
Now I cannot log-in in the control penal
Does any on know a Huck to fix the issue

josh.shand on "wp_referer_field function mod"

$
0
0

Hi guys,

I'm implementing a blog under /blog which isn't actually in a subfolder and not using MS.

We actually have the majority of this working so don't worry about that too much. My only requirement for any mods is that I don't modify any core files so upgrades are still supported.

I need to be able to "fix" the hidden _wp_http_referer input so that it contains /blog for admin pages otherwise I get thrown to the wrong page when I save settings with a POST. This is in wp-includes/functions.php (line 1263), like so:

$referer_field = '<input type="hidden" name="_wp_http_referer" value="/blog'. esc_attr( wp_unslash( $_SERVER['REQUEST_URI'] ) ) . '" />';

Editing the core functions.php works perfectly but I want to achieve this by some other method. As it's not a pluggable function is is possible to use an add_action somewhere to "re-set" the variable before the page is rendered?

Something along the lines of this (tried in a plugin and doesn't work)?

function custom_wp_referer_field( $echo = true ) {
	$referer_field = '<input type="hidden" name="_wp_http_referer" value="/blog'. esc_attr( wp_unslash( $_SERVER['REQUEST_URI'] ) ) . '" />';

	if ( $echo )
		echo $referer_field;
	return $referer_field;
}
add_action('admin_init','custom_wp_referer_field');

Hopefully this makes some sense anyway - let me know what the gurus come up with!

Cheers

Subharanjan on "No notification being displayed for plugin upgrade !!"

$
0
0

I updated the plugin code here http://wordpress.org/plugins/debug-bar-actions-and-filters-addon/ to version 0.3. But, no upgrade notifications are displayed on the wp-admin. This is happening for users who are having the initial release of the plugin i.e. Version 0.11 (Stable Tag: trunk ).

If I explicitly download the plugin version 0.2 from WordPress and install, it does show me notification for the Version 0.3.

Any help is greatly appreciated !!

vasen on "media-new.php How to upload on different folders?"

$
0
0

Hello!
I use WP on web-sites that have many files.
Need help in solving problem.
How to make WP upload files in different folders that I can create and name as I want?
And how to insert images using file browser in theese folders?

Now I only can install CKeditor and use default file manager to create folders and upload one file at a moment. I want to use WP flash-loader with ability to create folders.
Thanks.

silwalprabin on "Insert to custom Table does not Work"

$
0
0

My complete code is:

[insert_php]
global $wpdb;
$name = $_POST[txt_name];
$middlename = $_POST[txt_name];
$surname = $_POST[txt_surname];
$username = $_POST[txt_username];
$password = $_POST[txt_password];
$email = $_POST[txt_email];
$phone = $_POST[txt_phone];
$securityq = $_POST[txt_securityq];
$securitya = $_POST[txt_securitya];
$offerid = 1;
if($wpdb->query( $wpdb->prepare( "INSERT INTO $wpdb->user_reg( Name,Middle_Name,Last_Name,username,password,email,mobile,security_q,security_a)
                    VALUES (%s,%s,%s,%s,%s,%s,%d,%s,%s)",$name,$middlename,$surname,$username,$password,$email,$phone,$securityq,$securitya)))
echo "Sucess";
else
echo "NO";

[/insert_php]
<form class="reg_form" action="" method="post" enctype="multipart/form-data">

	Name:<input type="text" name="txt_name" id="txt_name">
	Sur Name: <input type="text" name="txt_surname" id="txt_surname">
       UserName <input type="text" name="txt_username" id="txt_username">
	Password:<input type="password" name="txt_password" id="txt_password">
	Email: <input type="text" name="txt_email" id="txt_email">
	Phone:<input type="text" name="txt_phone" id="txt_phone">
	Security Question<input type="text" name="txt_securityq" id="txt_securityq">
	Security Answer<input type="text" name="txt_securitya" id="txt_securitya">
	<input type="submit" name="btn_submit" id="btn_submit" value=:"Register">
</form>

[Moderator Note: Please post code or markup between backticks or use the code button. Or better still - use a pastebin. Your posted code may now have been permanently damaged by the forum's parser.]

Jon Bergman on "Get current attached media"

$
0
0

get_attached_media works great to get attachments that have been uploaded or 'attached' to a given post or page. The problem is when you remove one of these attachments say an image from your gallery, get_attached_media still returns that image in the array because it was originally uploaded to the post/page. The only way to remove it would be to delete it permanently from your media. Vise versa, get_attached_media will return null if you create a new gallery on a page with images already existing in your media.

I am not looking for a plugin but rather a programmatic solutions to get attachments. I am using get_attached_media because it returns the original url rather than the thumbnail.

current code:

<?php if ( have_posts() ) : ?>
   <?php while ( have_posts() ) : the_post(); ?>
      <?php $attachments = get_attached_media( 'image', $post->ID ); ?>
         <?php if ( $attachments ) : ?>
	    <ul>
	    <?php foreach ( $attachments as $attachment ) : ?>
	       <li><img src="<?php echo  wp_get_attachment_url($attachment->ID ); ?>"/></li>
	    <?php endforeach; ?>
            </ul>
	<?php endif; ?>
     <?php endwhile; ?>
 <?php endif; ?>

Thanks!

mitsol on "how to create custom page content in wordpress"

$
0
0

I posted my question here - [programminghelp24 link removed]

please answer in that site by registering first else here.

Thanks in advance


DigitalFormula on "How to add shortcodes to PHP namespace"

$
0
0

Hi all,

All my theme and plugin classes are part of my custom namespace, except for the shortcodes.

The classes have standard PHP __construct() methods that call methods like register_nav_menu(), for example. They work fine.

However, when I modify my shortcode file so that it's part of my namespace and call add_shortcode() in the constructor, the shortcodes no longer work - they just display the [shortcode params=""] markup. If the file isn't part of the namespace and I call add_shortcode() at the end of the file, they work fine.

Here's one of the add_shortcode() calls:

add_shortcode( 'social', 'social_shortcode');

The function's code is like this (with all the main parts removed as they aren't relevant):

function social_shortcode( $atts )
{
   /* do shortcode stuff here */
}

Is there a special way of calling add_shortcode() when the file is part of a namespace? If not, what am I doing wrong?

I've selected 3.7.1 as the WP version, although I'm using 3.8-beta1. The results are the same if I test the code on a production 3.7.1 site, though.

opoz1 on "Block random writes"

$
0
0

Hi I have a problem:
Infer block random writes code

<?php
     $MyArgs = array(
    'orderby' => 'rand',   // Способ сортировки: случайным образом.
    'showposts' => '2',  // Покажем лишь 5 записей. Можете и 10, и 17 вписать.
    'cat' => '2'  // Включаем только записи из рубрики с идентификатором, равным 6
  );
  query_posts($MyArgs); // Передаем параметры, заданные в массиве $args
  if (have_posts()) : // Далее идет типичный цикл вывода "постов".
    while (have_posts()) : the_post(); ?>           

                <h6 class="p2"><a href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a></h6>
               <div class="border padd-1">
           <?php the_excerpt(); ?>
              <a class="btn-1" href="<?php echo get_permalink(); ?>">Подробнее</a>
              </div>
<?php

how to make that <div class="border padd-(Assigning a serial number from 1 to2) \">

MMR at the last engine was so <div class="border padd-{% if(alternating == 'odd') %}1 {% else %}2 {% endif %} ">

brmac7 on "Adjusting coding??"

$
0
0

Hey guys, just wanted to know if someone can help me out with a minor coding issue, working in editor I have entered chat support coding into the body tag of my web page, the problem I have is the code itself inserts on all of my web pages and I want it to run on one page only. Can anyone tell me how to get this result please? Thanks in advance :)

david_the_gnome on "Override theme to use protocol reactive URL for images and fonts"

$
0
0

I'm using the Builder theme which directs all image link to http://myURL.com... and all Google fonts to http://fonts.googleapi.com... What I need to do is use a protocol reactive URL scheme with those elements so I can run a SSL and not have the http elements mixed in with https.

I am not familiar with how to do this. I am not adept with CSS or PHP altering but I could follow someone's guidance. I am really hoping there is a way to override this, even if it involves digging deep and rendering future updates to the theme impossible due to core code changes.

If anyone can help, I will be IMMENSELY grateful. Seriously.

Josiah Sprague on "Using Data from a Google Spreadsheet"

$
0
0

I've Googled for this, and I can't find exactly what I'm looking for.

I have a Google Spreadsheet that contains data that needs to be automatically published on a client's Wordpress site.

Previously, I published a link to the HTML version of the table. However, the client decided that an HTML table isn't "user friendly", so they want me to create a template that displays the data in an HTML/JS accordion layout.

Doing this manually, would be fairly straightforward, but create an unacceptable labor bottleneck since the client updates their Google Spreadsheet on a daily basis and expects the published information on the website to be continually up to date.

I'm aware that Google has a Data API, so I should be able to write some code that gets the data I need out of the Spreadsheet automatically and displays in a template on my Wordpress site.

What I don't know is the specifics of how to make this work. Are there any plugins for pulling data from a Google Spreadsheet and being able to output it in a free format, or is this going to be all custom coding using PHP and the Google Data API? If it has to be completely custom, are there any tutorials that could help me figure out exactly how to do it?

Essentially, if I could figure out how to pull the text from one particular cell and print it out on the html page via Wordpress, the rest would just be a matter of rinse and repeat until I get the page that I need built.

Viewing all 8245 articles
Browse latest View live




Latest Images