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

vaxace on "Getting the directory of another plugin"

$
0
0

I'm writing a plugin wherein I need to get the directory of another plugin.

The only functions that I've found that return a plugin directory all require a file within that plugin to be passed to them (e.g. plugin_dir_path( __FILE__ );).

This obviously won't work in my situation since I don't have the plugin's file.

Suggestions?

Thanks in advance.


SpartanCopy on "How to add plugin shortcode as php in template"

$
0
0

I am using Artpal which used the shortcode [artpal=insert] in the post content to add paypal button and pricing to the post.

Unfortunately the plugin does not provide a php version of this shortcode so it can added directly to the template. Is there a way to convert this in to a php script?

I have tried <?php echo ('[artpal=insert]'); ?> however this just displays the text [artpal=insert]

Any ideas on how I could imbed this into the template or turn it in to php command?

c0nc3pt.SF on "update_post_meta returns true, but doesn't work."

$
0
0

Hi all,

Hitting a major brick wall using update_post_meta in a particular instance. I'm writing a plugin and am using the the method in various other parts of the plugin, but for some reason it's not working in this particular metabox.

Here is the textarea:
<textarea id="sb_tweetbox" name="sb_tweetbox"><?php get_post_meta('_sb_saved_tweet'); ?></textarea>

Here is the instance for calling update_post_meta:

add_action('save_post','twtSavePost');

function twtSavePost(){
	global $post;
update_post_meta($post->ID,'_sb_saved_tweet',$_POST['sb_tweetbox']);
}

I confirmed that the $_POST data was coming through and that $post->ID was correct by using wp_die to output it. I also confirmed that the save action is working this way. When I assign update_post_meta to a variable and output the result it comes back at "1", which should mean that it successfully added the data to the database. However, this is no the case.

I am using update_post_meta all throughout the plugin and in my theme as well and I can't seem to find out why this particular instance is "working" but not working. Any assistance would be appreciated.

Cory.Nickerson on "Formating the_content()"

$
0
0

Which file contains the formatting code for the filter of the_content()? Cannot seem to find it. I'd like to see how it is formatting the content after it reads the plain texted stored in the database.

Markgoessens on "Exclude meta_key from wp_query"

$
0
0

Hi everybody,

I'm struggling for hours now with the following problem. What I'm trying to do is 'exclude reduced items from a wp-query array'

This is the code I allready have:

echo View::render('page-home.twig', array(
 'wp_query' => $wp_query,
 'posts' => aviators_properties_get_most_recent(4),
 'meta_key' => '_property_reduced',
 'meta_compare' => '!=',
 'meta_value' => true
   )
);

I know that the meta_key and meta_value is right. The first three lines is a part of the template which I use. So this is right too. But I'm not sure about the rest.

I tried several alternatives like: meta_compare IN / NOT IN / EXISTS / NOT EXISTS / = / LIKE

I also tried to put the meta things in an extra array. Like this:

echo View::render('page-home.twig', array(
 'wp_query' => $wp_query,
 'posts' => aviators_properties_get_most_recent(4),
 'meta_query' => array(
        array(
        'meta_key' => '_property_reduced',
        'meta_compare' => '!=',
        'meta_value' => true
    )
   )
  )
);

All of this doesn't work. Nothing changes at all.

The page where I'm working on is:http://www.theoquaedackers.nl/test At the bottom of this page you see 'recent toegevoegd' In this array I want to exclude reduced items.

Does anyone know what I'm doing wrong?

Greets Mark

frietbakker on "Removing function from pluggable.php"

$
0
0

The wp_mail function in my plugin does not override the core wp_mail.

The function declaration in the plugin is like this:

if (!function_exists("wp_mail")){
      function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()) {

When i remove the wp_from from pluggable.php, the wp_mail from the plugin is called. Otherwise the function from pluaggable.php is called.

What is going on?

Ann-Sophie on "Rewrite taxonomy slug in archive permalink"

$
0
0

I can access my custom taxonomies with this url: www.example.com/taxonomy-name/term

But I'd like to have this rewritten to www.example.com/term

Can anyone help me out with that? I have no idea where to start.

eflouret on "Call to undefined function wp_insert_term()"

$
0
0

Hello, I need to call wp_insert_term() from outside the wordpress environment.

Usually loading wp_load.php is enough to use all wordpress functions outside wordpress.

But that isn't working this time. So I added a call to the /wp-includes/taxonomy.php library.

No luck either.

What libraries do I have to load to use wp_intert_term() outside wordpress?

Thanks


howToPlease on "Calling widget using shortcode query poblem"

$
0
0

I am calling a widget using shortcode,
everything is wordking except when I passs a widget option as a query then it only accepts title.

Like
[widget name="WP_Widget_Categories"]title=Category&dropdown=1&count=1&hierarchical=1[/widget]

Now when this shortcode output then it shows my title query but no action for other three query. I tried this with all widget, same problem.

Please check if my query format is mistaken.

and here is my shortcode function

add_shortcode('widget','widget');
function ra_widget($atts, $content) {
	// Configure defaults and extract the attributes into variables
	extract( shortcode_atts(
		array(
			'name'  => ''
		),
		$atts
	));

	ob_start();
	the_widget($name, $content, 'before_widget=<div class="post-widget">&after_widget=</div>&before_title=<h3>&after_title=</h3>');
	$output = ob_get_clean();

	return $output;
}

tstrebeck on "Display same menu for parent and all its children"

$
0
0

I posted this yesterday, but I think this is a better way of wording what I'm wanting to accomplish...

I have three main directories in my site, and I'm wanting to display one unique menu for each directory and display it on each child of that directory. I'm thinking I create my three custom menus, but then what would be the best way to display the correct one for each section?

Thanks for your help!

zsero on "How to change the naming of the resized image files"

$
0
0

Now with custom image sizes Wordpress is almost as powerful as timThumb / phpThumb. There is one problem however. The way Wordpress handles the resized images are chaotic and doesn't survive theme changes / image size changes.

The problem is that wordpress names the files like: image-600x400.jpg, instead of naming them image-medium.jpg or image-custom.jpg.

Is it possible to override this behaviour? It would finally make Wordpress manage image sizes perfectly! You would just need to regenerate your thumbnails with any regenerator plugin, but your URL's would all work! (Also the size information should be removed from the posts.)

Shafan Hameed on "How to make a registration page and form"

$
0
0

Hi. i want to make a registration page with 2 types of categories but within my theme.

Means. i want to make a registration page with registration form. 1 for the customers and 2nd for the subscribers. what they will choose in the registration form weather they want to register on my website as a customer or a subscriber but i want them to register their selves in my website instead of wordpress official registration page just like my Login page. you can visit the login page here on My-Account.

Kindly help out in this issue.

hexagongirl on "Display error messages in custom login form"

$
0
0

I am using wp_login_form() to display a custom front-end login form.

I am then using the following code to ensure if the user inputs invalid login credentials or leaves username/password blank, they don't see the WP login page, but get re-directed to the current page.

add_action( 'wp_login_failed', 'hex_front_end_login_fail' ); // hook failed login

function hex_front_end_login_fail( $user ) {
  $referrer = $_SERVER['HTTP_REFERER']; // where did the post submission come from?
  // if there’s a valid referrer, and it’s not the default log-in screen
  if ( !empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin') && $user!=null ) {
    if ( !strstr($referrer, '?login=failed' )) { // make sure we don’t append twice
      wp_redirect( $referrer . '?login=failed'); // let’s append some information (login=failed) to the URL for the theme to use
    } else {
      wp_redirect( $referrer );
    }
    exit;
  }
}

add_action( 'authenticate', 'hex_front_end_blank_login');

function hex_front_end_blank_login(){
  $referrer = $_SERVER['HTTP_REFERER'];
  if ( !strstr($referrer,'wp-login') && $user==null ) { // login1 is the name of the loginpage.
    if ( !strstr($referrer, '?login=failed') ) { // make sure we don’t append twice
        wp_redirect( $referrer . '?login=failed' ); // let’s append some information (login=failed) to the URL for the theme to use
      } else {
        wp_redirect( $referrer );
      }
      exit;
  }
}

Problem: I am now trying to work out how to display the relevant error messages once the user has been re-directed. Have been pouring over it for hours & drawn a complete blank.

Any help gratefully received!
Thanks

jetkappu on "change login link"

AndrewND92 on "Count the number of categories one post has"

$
0
0

Does anyone know how to count the number of categories one post has?


DLOnline on "Stop current post featuring in recent post on single.php"

$
0
0

I am running a custom query for my recent posts, code can bee seen at:
http://pastebin.com/CFZdP3c9

My problem is that it shows my current page post item and I cannot figure out how to pass over it.

originally I tried

global $post;
$currentPost = $post->ID;
 if( $post->ID != $currentPost ) ?>
    (the loop)
endif;

but could not seem to get it to work correctly, it just didn't output anything.

Any insights are greatly appreciated!

Digex on "add an icon to homepage service tab"

$
0
0

I have a theme that i am customizing. I created 4 pages. On the homepage, below the featured slider, is a tabbed content area. Each tab is populated by one of my four pages.
I want to add icons to the top of the tabs. I tried to add a custom class. This worked, but it applies the same icon. I believe, I need to create an array to establish a new class for each tab. How is this done? here is the code that generates the tab array.

<?php if (have_posts()) : while(have_posts()) : the_post(); ?>
						<?php
							$hash = 'service_' . strtolower( preg_replace( '/ /','_', get_the_title() ) );
							$et_nova_settings = maybe_unserialize( get_post_meta( get_the_ID(),'et_nova_settings',true ) );

							$tab_title = isset( $et_nova_settings['et_service_tabtitle'] ) && !empty($et_nova_settings['et_service_tabtitle']) ? $et_nova_settings['et_service_tabtitle'] : get_the_title();
							$tab_subtitle = isset( $et_nova_settings['et_service_tab_subtitle'] ) && !empty($et_nova_settings['et_service_tab_subtitle']) ? $et_nova_settings['et_service_tab_subtitle'] : '';
						?>

						<li class="tw_iconset"><a href="#<?php #echo $hash; ?>"><strong><?php echo esc_html($tab_title); ?></strong><?php if ($tab_subtitle != '') { ?><span><?php echo esc_html($tab_subtitle); ?></span><?php } ?></a></li>

http://ghana.txtunited.com/public_html/
Notice the cloud icon, this is one of the 4 icons, I attached it by adding a class the <li> tag called "tw_iconset" and styled it in style.css.

How do I add the icons to the top of the tabs properly?

edrdesign on "Multiple Custom Post Type Admin Tables on One Page"

$
0
0

Is it possible to display multiple CPT admin tables on one page? I'm talking about the kind of full functionality you get(edit, quickedit, delete, etc.) within a single admin page? I don't want to use WP_List_Table unless absolutely necessary.

muhajirkhan on "want to create member directory"

$
0
0

hi to all,
i want to maintain the society member's directory on wordpress based website. i checked many plugin, but i am not satisfy with their functionality.

i want to make in manually. a little sketch in my mind is like this, but something is missing as conclusion.

1. make a table in database,
2. create custom page with fields.
BUT
i dont know how to display each member record in directory form on one page.

can someone help me in this regards ?
if something is missing in my explanation, do let me know, i will update you.

DesignNoir on "load more post on front-page template"

$
0
0

Hi!

I've made a front-page template that displays my selected pages and the 3 latest posts on the same page. Also comments are forced showing on each post.
I want to be able to load the next 3 posts by clicking a button without reloading the page.
I know about the pbd-ajax-load-post plugin and the infinite-scroll plugin but can't get those to work with my template.
Can someone please help me get this to work using the front-page template below?

<?php
/*
Template Name: Front
*/
get_header(); ?> 

<?php $args=array('orderby' =>'order','order' =>'asc','post_type' =>'page','post__in' => array(4,6,9,765)); $page_query = new WP_Query($args); ?>
<?php while ($page_query->have_posts()) : $page_query->the_post(); ?>

<section id="<?php echo $post->post_name;?>" class="post_page jumpAnchor"><a>">.</a>
<article class="container" id="<?php echo $post->post_name;?>_content">
<?php the_content(); ?>

</article><!--end article-->
</section><!--end section-->

<?php endwhile; ?>

<?php
$args = array( 'numberposts' => 3 );
$lastposts = get_posts( $args );
foreach($lastposts as $post) : setup_postdata($post); ?>
<section id="<?php echo $post->post_name;?>" class="post jumpAnchor"><a>">.</a>
<article class="container" id="<?php echo $post->post_name;?>_content">

<div class="post-meta">
<?php $categories = get_the_category(); $cat_slug = $categories[0]->slug; echo "<div class='post $cat_slug'>";   ?><?php foreach((get_the_category()) as $cat) { echo $cat->cat_name . ' '; } ?></div><p class="small">Skrivet den <?php the_time('j F, Y') ?> av <?php the_author_posts_link() ?></p>
</div><!-- .post-meta -->

<h3><?php the_title(); ?></h3>
<?php the_content(); ?>

<?php
$withcomments = 1; // force comments form and comments to show on front page
comments_template();
?>

</article><!--end article-->
</section><!--end section-->

<?php endforeach; ?>

<?php get_footer(); ?>

[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/corrupted by the forum's parser.]

Viewing all 8245 articles
Browse latest View live




Latest Images