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

olehellhound on "Toolbar Roles"

$
0
0

Hello,

I'm creating a plugin and I got the idea to create menus in the WP Toolbar for my backend pages. I've added a user as a subscriber and want for the menu that I have created to appear in the subscribers' admin bar because there will be dynamic content created within my plugin. Is this possible, and if so, how do I do it? Here is my code:

//admin bar objects
add_action( 'admin_bar_menu', 'toolbar_link_to_mypage', 999 );
function toolbar_link_to_mypage( $wp_admin_bar ) {
  $args = array(
    'id' => 'Spectrum',
    'title' => 'Manage Spectrum',
    'href' => site_url('/spectrum'),
    'meta' => array('class' => 'Spectrum-page')
  );
  $wp_admin_bar->add_node($args);
}

Thanks


jp2112 on "Best practice for updating readme.txt"

$
0
0

I would like to know what is the best practice for updating documentation when there are no updates to the plugin itself.

I have an updated FAQ section for my readme.txt due to issues identified in the forum. But I don't want to increment the version because there are no real changes to the plugin files. Is this permitted?

gemonon on "ImpressJS theme integration quirk"

$
0
0

Hey there,

I am trying to get impress.js to work well with wordpress and am running into a weird issue I can't figure out.

You can see the working implementation here:
http://www.no-more-war.net/no-more-war-presentation/#/Title

However, there is a quirk: Notice the first line in html just being a "'". That comes from the header-simple.php
Without it, the presentation switches to fallback-mode as if impress.js were not there or my browser were not supported.

You can see that here:
http://dev.no-more-war.net//wp/?page_id=13&preview=true#/Title

I do not have a clue, why that would be. I tested it several times and the symptom remains the same. Removing that ' at the start of the html file stops impress.js from working.

Anybody any ideas?

Here the source files for reference: http://dev.no-more-war.net/wp/presentation-theme-extension.zip

Copying them into the theme directory should be enough, then you can select the page template (impress-page) when you create a new page and just enter this to get a working impress slide:

<div class="step slide" id="Title" data-x="0" data-y="0">
<h1>Test</h1>
</div>

The rest is taken over by impress-page.php template, which calls header-simple.php for the header information. I tested it with a motion child theme and with a twentytwelve child theme.

Therefore I hope these files should work in any theme, as far as I can tell – but I am by no means experienced enough, so use them with caution and without waranty of any kind!

Would be great if someone could have a look at it and help me fix this annoying issue!

mcwolf00 on "How to build a feature like this?"

$
0
0

Hi all,

I am using the latest Wordpress, and I want to build this function in my site:

1. There is a form at the front-end, that user can insert their height, weight, age and gender. After they click submit, the next page will depend on their entries and show the different result (different page).

2. In back-end, there is also a interface that can show all the entries. And admin can filter the entries like showing the list of age from 20 to 40 and gender is male.

It looks like a form, but I can not find a similar one. (I tried Gravity Form and Formidable, they are not suitable.)

Can you recommend a similar plugin to me, or show me some example that I can code it myself. (I can handle the front-end, but don't know how to play with the back-end.)

Cheers,
Mcwolf

zaone on "User auto log out based on role"

$
0
0

Hello, is there any way to automatically log out a user based on his role? I mean, if a user has the "No role for this site" role set for it, is there any way to log him out automatically when he tries to log in and is greted by the insufficient priviledges message?
Thanks.

zozopelli on "colorbox make title a link"

$
0
0

In colorbox, make the title a link to the post. The wordpress link needs to be dynamic. Colorbox is grabbing the thumbnail and title. How do I get it to add the url. The link would close the colorbox and open the post.

I am learning and would appreciate if someone could point me in the right direction.

Here is the jquery function from colorbox:
$('a.gallery').colorbox({title:function () {
return "To view full size, " + "click here!".link(this.href);
}});

Thank you, Thank you for any help!

alirezaChimeh on "showing especial category of posts"

$
0
0

HI all
in my wordpress theme (monaco) there is a slider that shows all pictures summery of main posts (main page).
how can I show info of especial category in slider?
the code for summery of the post is:

<?php 	$count = of_get_option('w2f_slide_number');
				$slidecat =of_get_option('w2f_slide_categories');
				$query = new WP_Query( array( 'cat' =>$slidecat,'posts_per_page' =>$count ) );
	           	if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post();	?>

bramwittendorp on "MySQL database installation is not working"

$
0
0

For my first WordPress plugin I chose to make it my self difficult because I want to use a new table in the WordPress database installation.

However if I install the plugin the database tables are not created for some sort of reason. I checked the query in phpMyAdmin and it runs fine in there so there aren't any errors in the query, but what am I doing wrong?

<?php
// database creation
function create_rozenactie(){

$sql1 = "CREATE TABLE rozenactie (
  order_id int(11) NOT NULL AUTO_INCREMENT,
  ontvanger varchar(225) NOT NULL,
  klas_ontvanger varchar(50) NOT NULL,
  boodschap varchar(250) NOT NULL,
  aantal int(11) NOT NULL,
  bedrag int(11) NOT NULL,
  afzender varchar(225) NOT NULL,
  klas_afzender varchar(225) NOT NULL,
  email varchar(250) NOT NULL,
  betaalmoment varchar(250) NOT NULL,
  betaald varchar(200) NOT NULL,
  anoniem varchar(20) NOT NULL,
  PRIMARY KEY  (order_id)
);";

require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
dbDelta($sql1) or die("Instalatie tabel Rozenactie mislukt");

}

function create_algemeen(){

$sql2 = "CREATE TABLE algemeen(
  actief varchar(25) NOT NULL,
  prijs varchar(11) NOT NULL
);";

require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
dbDelta($sql2) or die("Instalatie tabel Algemeen mislukt");
}

function insert_general_settings(){
global $wpdb;

$aanpassen = $wpdb->insert( algemeen, array('actief' => 'true', 'prijs' => '1') );
$aanpassen;
}
?>

hyoon01 on "How to loop through PAGES in custom Navigation Menu"

$
0
0

So for my website, I am making it so that the content of each page in the current navigation menu would be displayed on the main home page.

So main question is, how would I write the query so that it looks up all the pages which are in the navigation menu?

Would I need to find out the page_id of each page in the menu and then pass that information through query? If so, how would I find the page_id of the nav_menu?

Pressnoob on "Amazon Product API plugin that retrieves the list price and the lowest price"

$
0
0

So I really want to make a plugin like this: http://www.convertazon.com/demo/ except without the cheesy loading bar and other stuff.

I'm just wondering if anyone has any experience creating Amazon product APIs and if you have any advice. I've never made a WP plugin myself.

This would go on top of the page:

<?php
    include("amazon_api_class.php");

    $obj = new AmazonProductAPI();

    try
    {
        $result = $obj->getItemByAsin(B0067HQL30);
    }
    catch(Exception $e)
    {
        echo $e->getMessage();
    }

function percent($Retail, $Low) {
$count1 = $Retail - $Low;
$count2 = $count1 / $Retail;
$count3 = $count2 * 100;
$count = number_format($count3, 2) . "%";
return $count;
}

$LowestP = $result->Items->Item->OfferSummary->LowestNewPrice->Amount;
$MSRP = $result->Items->Item->ItemAttributes->ListPrice->Amount;
$Savings =  $MSRP - $LowestP; 

$LowestP2 = number_format($LowestP /100,2);
$MSRP2 = number_format($MSRP /100,2);

?>

And this goes to the body of the page to style in however you'd like.

<h1> Percent: <?php echo percent($MSRP, $LowestP); ?> </h1>
<h2> Retail Price:$ <?php echo $MSRP2; ?> </h2>
<h1> Lowest Price:$ <?php echo $LowestP2; ?> </h1>
<h2> Total Savings:$ <?php echo number_format($Savings /100,2); ?> </h2>

There is only one real dynamic aspect of the plugin, the string of the function getItemByAsin. I guess you'd just retrieve the value from the WYSIWYG editor, is that it?

liiam on "Call Custom Field inside shortcode or php within the template"

$
0
0

Hi

I am using the Simple WP Shopping Cart

They offer short code and php options for inserting a button which is:

<?php echo print_wp_cart_button_for_product(’PRODUCT-NAME’, PRODUCT-PRICE); ?>

or

[wp_cart:PRODUCT-NAME:price:PRODUCT-PRICE:end]

As you can see for each button you need to set the name and price.

I have made a custom post type with custom fields using ACF plugin (advanced custom fields plugin)

I have successfully called some of those custom fields into my template but I would like to insert the "price" custom field and the "post title" into the shortcode (or php) of the shop button.

for example

echo '<h2>';the_title();echo '</h2>';
	echo the_field('price');
	 echo '<img src="';the_field('image');echo '">';
        echo print_wp_cart_button_for_product(‘echo the_title();’, echo the_field('price'); );
         the_excerpt();

I have tried several variations but it either doesnt do anything or it breaks the page.

I am calling the custom post type in groups of 3 as well, in line with the layout I want to achieve so the full code to pull the posts is

<?php

// Show a selected number of posts per row
$posts_per_row = 3;
$posts_per_page = 9;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
   'posts_per_page' => $posts_per_page,
   'paged' => $paged,
   'post_type' => product,
);
query_posts($args);
if (have_posts()) {
   while (have_posts()) {
      the_post();
      if ((++$post_counter % $posts_per_row) == 1  || $posts_per_row == 1) {
         if ($post_counter > 1) {
            echo "</div><!-- End of post_row -->\n";  // End previous row
         }
         echo "<div class='post_row'>\n";  // Start a new row
      }
      echo "<div class='grid_4'>\n";  // Start one post
         // Output post data here
         echo '<h2>';the_title();echo '</h2>';
	echo the_field('price');
	 echo '<img src="';the_field('image');echo '">';
        echo print_wp_cart_button_for_product(‘wordpress’, 7.50);
         the_excerpt();
      echo "</div><!-- End of post_class -->\n";  // End of post
   } ?>
   </div><!-- End of post_row -->
   <div class='clear'></div>
   <div>
      <div><?php next_posts_link('« Older Entries') ?></div>
      <div><?php previous_posts_link('Newer Entries »') ?></div>
   </div>
<?php } else {
   // Code for no posts found
}
?>

If that helps any further.

Hopefully I have explained clearly enough that someone might know what I want to do, even if you dont know how to solve it but you know what terms I should be googling for etc please let me know.

Thanks in advance

clickmac on "Adding Drag and Drop for user uploads"

$
0
0

if their is any such plugin, i don't think it would be for free

mullion on "Create/Edit user without Email Adresse"

$
0
0

Hello,

I need to be able to create/edit user without email adresse.

I tried to find how the wordpress core works. But it's kind of very complex to simply remove all the "required validation" for the email adress.

Thank you

Vincent

keyrun00 on "How to add PHP code and HTML code in admin bar?"

$
0
0

I want to add php code like <?php wp_loginout($_SERVER['REQUEST_URI']); ?> to my admin bar. Is there any possible way? and also, is there anyway to add html code in admin bar?
Thanks for your time and consideration.

itsprecious on "Admin Email in database of Version 3.5.1"

$
0
0

I hope this is the correct place for this question. I'm not a developer, but can find my way around the database of my site. I purchased a domain and installed WP directly from GoDaddy's platform. From what I'm researching and reading, it's typical for there a code to be placed on the database with simple installs that will make send notifications as Wordpress{at}yourwebsite{dot}com. I have my correct email listed in both user and settings, but my site is still sending emails from the Wordpress email address of my site, that I never associated with my site.

My question is: Where can I find the code within the database to change the WP email address that I do not desire?

Any help would be AWESOME and great appreciated. :)


credo61 on "Add a tinyMCE plugin + WordPress functionality"

$
0
0

Hi,

I've added a button to tinyMCE which loads a php file into the iframe.
Actually it's a shortcode manager and I need to use some wordpress functionality such as translation functions or getting categories list or ...

To do this, I need to include wp-load.php and every thing works great with it. But I read on the forums that including wp-load.php is not a good practice at all!

So what's the best solution for my problem? Is there any way to load tinyMCE plugin without loading it within iframe or is there any other way to use wordpress functions in a file which is loaded into iframes or popups?

Thanks.

mrpritchett on "Category image display"

$
0
0

I am using a script found at http://wpdevsnippets.com/add-category-tag-taxonomy-picture/. However, I cannot get the writer to answer a usage question, so here it is:

How do I use this script with a custom taxonomy on a page.php or archive.php template?

add_action('admin_head', 'wpds_admin_head');
add_action('edit_term', 'wpds_save_tax_pic');
add_action('create_term', 'wpds_save_tax_pic');
function wpds_admin_head() {
$taxonomies = get_taxonomies();
//$taxonomies = array('category'); // uncomment and specify particular taxonomies you want to add image feature.
if (is_array($taxonomies)) {
    foreach ($taxonomies as $z_taxonomy) {
        add_action($z_taxonomy . '_add_form_fields', 'wpds_tax_field');
        add_action($z_taxonomy . '_edit_form_fields', 'wpds_tax_field');
    }
}
}

// add image field in add form
function wpds_tax_field($taxonomy) {
wp_enqueue_style('thickbox');
wp_enqueue_script('thickbox');
if(empty($taxonomy)) {
    echo '<div class="form-field">
            <label for="wpds_tax_pic">Picture</label>
            <input type="text" name="wpds_tax_pic" id="wpds_tax_pic" value="" />
        </div>';
}
else{
    $wpds_tax_pic_url = get_option('wpds_tax_pic' . $taxonomy->term_id);
    echo '<tr class="form-field">
    <th scope="row" valign="top"><label for="wpds_tax_pic">Picture</label></th>
    <td><input type="text" name="wpds_tax_pic" id="wpds_tax_pic" value="' . $wpds_tax_pic_url . '" /><br />';
    if(!empty($wpds_tax_pic_url))
        echo '<img src="'.$wpds_tax_pic_url.'" style="max-width:200px;border: 1px solid #ccc;padding: 5px;box-shadow: 5px 5px 10px #ccc;margin-top: 10px;" >';
    echo '</td></tr>';
}
echo '<script type="text/javascript">
    jQuery(document).ready(function() {
            jQuery("#wpds_tax_pic").click(function() {
                tb_show("", "media-upload.php?type=image&TB_iframe=true");
                return false;
            });
            window.send_to_editor = function(html) {
                jQuery("#wpds_tax_pic").val( jQuery("img",html).attr("src") );
                tb_remove();
            }
    });
</script>';
}

// save our taxonomy image while edit or save term
function wpds_save_tax_pic($term_id) {
if (isset($_POST['wpds_tax_pic']))
    update_option('wpds_tax_pic' . $term_id, $_POST['wpds_tax_pic']);
}

// output taxonomy image url for the given term_id (NULL by default)
function wpds_tax_pic_url($term_id = NULL) {
if ($term_id)
    return get_option('wpds_tax_pic' . $term_id);
elseif (is_category())
    return get_option('wpds_tax_pic' . get_query_var('cat')) ;
elseif (is_tax()) {
    $current_term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
    return get_option('wpds_tax_pic' . $current_term->term_id);
}
}

And here is the function that is used to call this:

wpds_tax_pic_url();
or

wpds_tax_pic_url($category->cat_ID);
How do I use this script with a custom taxonomy on a page.php or archive.php template?

johnlanglois on "How to Check cart for Simple Product"

$
0
0

In WooCommerce 2.0.12 I have a filter, add_filter( 'woocommerce_add_to_cart_validation), that does not need to run if the product being added is a simple product.

Is there a variable I could check or a function call that would let me know that the product being added is a simple product so that I could just return?

Thanks

rocknets on "How to add plugin menu to available widgets page"

$
0
0

I have created my own custom plugin - a very simple one to learn with.
I have activated it and it is showing as active.

My question is... How do I make the plugin available in the available widgets screen? I had expected to see it there.

This must be so simple but I have been trawling the web for hours.

Regards

Stephen

magootim on "FORCE_SSL_ADMIN"

$
0
0

I'm trying to make my admin section a bit more secure by using define('FORCE_SSL_ADMIN', true);
I've put this line of code in my wp-config.php file fine. I understand that this then tells the browser to look for admin files under https.

My problem is this: my hosting company puts my ssl folder under a completely different domain. Is there an easy way to reroute FORCE_SSL_ADMIN to this domain rather than just https of my existing domain?

Viewing all 8245 articles
Browse latest View live




Latest Images