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

Pete on "Custom taxonomy template not working with my CT"

$
0
0

I have this template... taxonomy-limestone-render.php

I have this CT function that works fine in the back end...

add_action( 'init', 'register_taxonomy_limestone_render' );
    function register_taxonomy_limestone_render() {
    $labels = array(
    'name' => _x( 'Limestone Render', 'limestone-render' ),
    'singular_name' => _x( 'Limestone Render', 'limestone-render' ),
    'search_items' => _x( 'Search Limestone Render', 'limestone-render' ),
    'popular_items' => _x( 'Popular Limestone Render', 'limestone-render' ),
    'all_items' => _x( 'All Limestone Render', 'limestone-render' ),
    'parent_item' => _x( 'Parent Limestone Render', 'limestone-render' ),
    'parent_item_colon' => _x( 'Parent Limestone Render:', 'limestone-render' ),
    'edit_item' => _x( 'Edit Limestone Render', 'limestone-render' ),
    'update_item' => _x( 'Update Limestone Render', 'limestone-render' ),
    'add_new_item' => _x( 'Add New Limestone Render', 'limestone-render' ),
    'new_item_name' => _x( 'New Limestone Render', 'limestone-render' ),
    'separate_items_with_commas' => _x( 'Separate limestone render with commas', 'limestone-render' ),
    'add_or_remove_items' => _x( 'Add or remove Limestone Render', 'limestone-render' ),
    'choose_from_most_used' => _x( 'Choose from most used Limestone Render', 'limestone-render' ),
    'menu_name' => _x( 'Limestone Render', 'limestone-render' ),
    );
    $args = array(
    'labels' => $labels,
    'public' => true,
    'show_in_nav_menus' => true,
    'show_ui' => true,
    'show_tagcloud' => true,
    'show_admin_column' => false,
    'hierarchical' => false,
    'rewrite' => true,
    'query_var' => true
    );
    register_taxonomy( 'limestone-render', array('page'), $args );
    }

But I get a 404 when i try to view the CT??

Any help appreciated
Pete


Adrian Houle on "if I already loaded the Jquery library"

$
0
0

Hi. If I already linked to the Jquery library because I need it for the animate function, is there any disadvantage of excessive use of Jquery in other instances were I could just use plain JavaScript?

I am talking purely from a load size point of view. I also like the fact that Jquery creates less code so that it is easier to read.

Thanks,
-Adrian

Noel Forte on "Working with Transients"

$
0
0

Hi-

I'm new to the transients API, and am trying to set up a page that runs a series of loops and database queries, outputs them to HTML as a variable, saves it to the database, and then can be accessed at any time.

If a user gets updated, I need the queries to be re-run and a new copy of the page to be generated.

I've already taken a look at the API page, and have gotten it pretty close to what I want, however, when I save a user into the database, the transient just gets cleared by a function/action I have set up in functions.php. However, a new page doesn't get re-generated. Help?

Thanks,

Noel

danielpferreira on "iThemes Security: is it normal to have so many Site Lockout Notifications?"

$
0
0

Hello,
I would like to know if it is normal to have several Site Lockout Notifications every day.

I did find similar questions about this in the forum, but most deal with more specific cases, such as users being locked out, which is not my case. I am not being locked out.

I am OK just ignoring the email warnings, but since my website doesn't have much traffic, I am just wondering if maybe I am doing something wrong.

Is it common for a low profile site be attacked this often?

The message I get from iThemes Security is formatted as so:
"Dear Site Admin,
A host, 123.26.50.56, has been locked out of the WordPress site at http://www.7luas.com.br due to too many bad login attempts.
The host has been locked out until 2014-04-07 01:19:09"

The IP doesn't seem to repeat itself.

I also receive emails from iThemes regarding file changes, but those are OK (I always recognize the change as being made by me).

Please let me know what kind of additional information I can give to better clarify my situation.

Thank you!

hatshatshats on "Plugin for Real Estate site"

hatshatshats on "Expandable table?"

almerika on "Hide buy button on products with specific tags WP E-commerce"

$
0
0

Hi.
Using WP E-commerce and Storefront Elegance theme for an online store. Trying to use a product tag as a condition to hide the buy-button and quantity update (on the single product page) for some products that only can be bought in the physical store (can't be shipped).

I've tried with css and it works fine but only on one specific product (post-1928) and not on a whole product tag.

Here's the css:
.post-1928.wpsc-product.type-wpsc-product .wpsc_quantity_update {
display: none;
}
.post-1928.wpsc-product.type-wpsc-product .productcol fieldset legend {
display: none;
}
.post-1928.wpsc-product.type-wpsc-product input.wpsc_buy_button {
display: none;
}

Here's the test-product: http://www.olsonsab.se/produkter/tillbehor/testprodukt-2/
Here's the product tag: http://www.olsonsab.se/etikett/demoex/

I've also tried a php code in the wpsc-single_product.php that hides the buy button if you're not logged in.

<?php if((get_option('hide_addtocart_button') == 0) && (is_user_logged_in()) && (get_option('addtocart_or_buynow') !='1')) : ?>

That example works good but I don't know what to put in instead to use the function for products with a specific tag. The tag is "demoex" (term-134).

Would really appreciate some help here. I've been searching for days.

V Bao Thu on "How to echo widget in before_title and after_title"

$
0
0

Hello everyone.

I am using Bootstrap to style collapse Widget

This is my code register sidebar

http://pastebin.com/Pp6bqcPc

register_sidebar( array(
		'name' => __( 'Main Sidebar', 'twentytwelve' ),
		'id' => 'sidebar',
		'description' => __( 'Main Sidebar for Destop', 'twentytwelve' ),
		'before_widget' => '
          <aside id="%1$s" class="panel panel-success">
		',
		'after_widget' => '
              </div>
            </div>
          </aside>
		',
		'before_title' => '
            <div id="%1$s" class="panel-heading">
              <h4 class="panel-title">
                <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
		',
		'after_title' => '
                </a>
              </h4>
            </div>
            <div id="collapseOne" class="panel-collapse collapse in">
              <div class="panel-body">
		',
	) );

My question : How to echo variable %1$s in before_title and after_title.

I also try, but it doesn't work.

'before_title' => '
            <div id="%1$s" class="panel-heading">
              <h4 class="panel-title">
                <a data-toggle="collapse" data-parent="#accordion" href="#%1$s">
		',
		'after_title' => '
                </a>
              </h4>
            </div>
            <div id="%1$s" class="panel-collapse collapse in">
              <div class="panel-body">
		',

Please tell me how to do that. Thank you very much !


lownice on "Adding URL Conditions to Featured Image via Custom Fields"

$
0
0

I would like to add links to a featured image on some of my single posts. These links need to be unique in a way that it adds my Amazon Affiliate ID.

I made a custom field called “az-post” which I populate when making the post (or mass importing via CSV). To test things out I added the following code to my post-head.php.

<div class=”single-post-thumb”>
<?php if(get_field(‘az-post’)): ?>
<a href=”http://www.amazon.com/dp/<?php the_field(‘az-post’); ?>?tag=myamazonid-20″><?php tie_thumb( $size ); ?></a>
<?php endif; ?>
</div>

With my affiliate ID entered in the “az-post” custom field…everything works as intended.

The problem is when I have a post with no affiliate id in “az-post”. The featured image does not display in the single post.

How would I get the following logic:

If I make a post that uses my affiliate id via custom fields, then it should append a URL to the featured image with my amazon affiliate id. (like the example code above)

IF a post does NOT have my affiliate ID entered THEN use the original theme code below:

<div class=”single-post-thumb”>
<?php tie_thumb( $size ); ?>
</div>

Thanks!

goughie on "code for adding sporting pulse fixtures to wordpress"

$
0
0

code for adding sporting pulse fixtures to wordpress

mobilewebexpert on "Modify admin query so that keyword is searched for in title AND custom field"

$
0
0

How do I make it so that when an admin uses the 'Search Posts' form on the 'All Posts' admin page, the search word that he types in is used by WP to return posts where the 'post_title' field *OR* a custom field contains the search word.

I'm using the pre_get_posts action hook to modify the $query variable but WP seems only to be doing an AND search rather than the required OR search. Here is my code:

function my_pre_get_posts( $query ) {
    if ( is_admin() && $query->is_main_query() && $query->query['post_type'] === 'post' && isset($query->query['s']) ) {

        $search_word = $query->query['s'];
        //echo '<!-- keyword: ' . $search_word . ' -->';

        /*
         * This only ANDs the post's title value and its my_field value.
         * (I need it to OR the two values.)
         */

        //$query->query_vars['meta_key'] = 'my_field';
        //$query->query_vars['meta_value'] = $search_word;
        //return

        /*
         * Same problem as above with this technique.
         */

        //get the existing meta query
        $meta_query = $query->get('meta_query');

        $meta_query_args = array( //Add our meta query to the original meta query
            'relation' => 'OR', // Optional, defaults to "AND"
            array(
                'key' => 'my_field',
                'value' => $search_word,
                'compare' => 'LIKE',
            ),
            /*
            //Including this sub-array makes no difference at all. It seems WP is using it's own code somewhere to search in post_title.
            array(
                'key' => 'post_title',
                'value' => $search_word,
                'compare' => 'LIKE',
            ),
             */
        );

        //Set $meta_query
        if (is_array($meta_query)) {
            //Add to array
            $meta_query[] = $meta_query_args;
        }
        else {
            //Set/replace array
            $meta_query = $meta_query_args;
        }

        //set revised query
        $query->set('meta_query', $meta_query);
        //$query->set('meta_key', 'my_field');

        //echo '<!--';
        //print_r($query);
        //echo '-->';

    }
}
add_action( 'pre_get_posts', 'my_pre_get_posts' );

I don't think the problem is in my code. I think the problem is that WP is ANDing the meta_query with the post_title in its SQL, so how do I make it OR them instead?

Thanks in advance!

Pete on "CSS question - How do I reduce the margin between these widgets?"

$
0
0

I'm not posting this under the Theme forum as I've made big changes to it... I'm ripping the guts out of the 'Responsive' Theme (sorry theme guys)

http://www.brisbanestonerender.com.au

Screenshot here.. http://snag.gy/27rC4.jpg

When the bottom 3 widgets are responsified they go underneath the sidebar widgets but the margins are too big. I've tried everything to reduce the bottom 3 widgets (home-widgets) margins but I can't get it to work without stuffing up the sidebar widgets!!

Any help hugely appreciated
Thanks, Pete

Evan Herman on "Buy Quality Passports,Driver’s License,ID Cards,Visas,birth certificate,stamps"

$
0
0

Where's the admin when you need one?

I'd love admin rights, as I'm always lurking on these support forums and would help out weeding out spammers like this.

Please consider.

KarlN on "TinyMCE inserting unnecessary characters into image SRC URLs"

$
0
0

I am using the WP_editor function to add some content to a custom database table, the only problem I have come across is with images, TinyMCE is adding some unnecessary characters which is preventing the images from being displayed.

Example:

src="\"http://localhost:8888/wordpress/wp-content/uploads/2014/04/dscn7122-300x225.jpg\""

Should be:

src="http://localhost:8888/wordpress/wp-content/uploads/2014/04/dscn7122-300x225.jpg"

Isidoros Rigas on "How to disable images? (0.domain.com)"

$
0
0

Hello world,

I have a techblog and I want to create an image-free version, something like 0.domain.com like 0.facebook.com, because I usually use large images. My friend complained that his data (30MB) "dried up" quickly while he browsed Fb and my blog. So, how can I do it if I keep the same theme? Do you think it worths trying?

Thanks in advance.


KarlN on "Modifying Author Pages"

$
0
0

I would like to add some information from the database to the bottom of the bio on the author page.

I am doing this via a plugin, I have the data entry ready to go but I can't figure out how to pull the information from the database and add it to the page.

Obviously I don't expect an exact answer, but if someone could point me in the right direction I would appreciate it.

armanddc on "Woocommerce thumbnails in Shortcodes"

$
0
0

Hello everyone!

I'm having a bit of a problem with the Woocommerce shortcodes, as it shows too large product thumbnails, which doesn't look good in my design.

Here's the page I need help with.
I use the free theme BigFoot by THB Themes.

Hope you can help me with this. Thanks in advance!
~Armando Dela Cruz

jronder on "removing pingback"

$
0
0

I was told to drop my meta pingback. I have it disabled in settings-discussion, if that is the same. Can somebody advice how can I do it please?

thank you very much,
July Ronder

Sergio Ronei Hentz on "Alt Text automatic when upload image"

$
0
0

Hei Ya!

I wonder if there is a way when uploaded an image rather than the image name appears in the "Title" field appear directly "Alternative Text"
 
It seems silly but it will save me lots of ctrl-c / ctrl-v.
 
Thank's!
Sergio Hentz

*sorry bad english!

RyAnaon on "Custom Post Type and WP_query"

$
0
0

Hello,

I'm not really sure about the section but I tried.

For a week now, I'my trying to use que custom post type correctly for my project.

But now, I managed to do what I need for the single page.

I need one more thing and this is for the archive page.

Is it possible to group the post type by month with only one wp-query or do I need to create one request for one month on my side and update it every month?

And how to display a field on the archive page like the date?

Here is the code for my page-cruises.php

<?php
/*Template Name: Cruises list*/

get_header(); ?>

    <div id="primary" class="content-area eight columns">
        <div id="content" class="site-content" role="main">

			<article class="hentry">

			    <?php
                    if ( function_exists('yoast_breadcrumb') )
                    {
                        yoast_breadcrumb('<p id="breadcrumbs">','</p>');
                    }
                ?>

				<?php $loop = new WP_Query(array( 'post_type' => 'cruises', 'posts_per_page' => 10, 'order' => 'ASC' )); ?>

				<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>

				<header class="entry-header">

				<?php the_title( '<h1 class="entry-title"><a href="' . get_permalink() . '" title="' . the_title_attribute( 'echo=0' ) . '" rel="bookmark">', '</a></h1>' ); ?>

				</header>

				<div class="entry-content">
					<?php  the_excerpt(); ?>
				</div>
				<?php endwhile; ?>

			</article>

		</div><!-- #content .site-content -->

	</div><!-- #primary .content-area -->

<?php get_sidebar(); ?>

<?php get_footer(); ?>

and the custom post type on function.php :

add_action('init', 'cruises_init');
function cruises_init()
{
    $labels = array
    (
        'name' => _x('Croisières', 'post type general name'),
        'singular_name' => _x('Croisière', 'post type singular name'),
        'add_new' => _x('Ajouter nouvelle', 'portfolio item'),
        'add_new_item' => __('Ajouter nouvelle croisière'),
        'edit_item' => __('Modifier croisière'),
        'new_item' => __('Nouvelle croisière'),
        'view_item' => __('Voir croisière'),
        'search_items' => __('Chercher croisière'),
        'not_found' =>  __('Rien trouvé'),
        'not_found_in_trash' => __('Rien trouvé dans la poubelle'),
        'parent_item_colon' => ''
    );

    $args = array
    (
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true,
        'query_var' => true,
        'rewrite' => true,
        'capability_type' => 'post',
        'hierarchical' => false,
        'menu_position' => null,
        'supports' => array('title', 'editor', 'thumbnail', 'revisions', 'page-attributes')
    );

    register_post_type( 'cruises' , $args );

    register_taxonomy("Armateur", array("cruises"), array("hierarchical" => true, "label" => "Armateurs", "singular_label" => "Armateur", "rewrite" => true));

    add_action("admin_init", "admin_init");

    function admin_init(){
        add_meta_box("cruises_titles", "Titres de la croisière", "cruises_titles", "cruises", "normal", "low");
        add_meta_box("cruises_details", "Détails de la croisière", "cruises_details", "cruises", "normal", "low");
        add_meta_box("cabins", "Cabines", "cabins", "cruises", "normal", "low");
    }

    function cruises_titles()
    {
        global $post;
        $custom = get_post_custom($post->ID);
        $slogan = $custom["slogan"][0];
        $theme = $custom["theme"][0];
        ?>
        <p><label>Slogan :</label><br />
            <input type="text" name="slogan" value="<?php echo $slogan; ?>" /></p>
        <p><label>Thème :</label><br />
            <input type="text" name="theme" value="<?php echo $theme; ?>" /></p>
    <?php
    }

    function cruises_details()
    {
        global $post;
        $custom = get_post_custom($post->ID);
        $ship = $custom["ship"][0];
        $travel = $custom["travel"][0];
        $departure = $custom["departure"][0];
        $duration = $custom["duration"][0];
        $price = $custom["price"][0];
	    $details = $custom["details"][0];
        ?>
        <p><label>Navire :</label><br />
            <input type="text" name="ship" value="<?php echo $ship; ?>" /></p>
        <p><label>Circuit :</label><br />
            <textarea cols="50" rows="5" name="travel"><?php echo $travel; ?></textarea></p>
        <p><label> Date départ :</label><br />
            <input type="text" name="departure" value="<?php echo $departure; ?>" /></p>
        <p><label>Durée :</label><br />
            <input type="text" name="duration" value="<?php echo $duration; ?>" /></p>
        <p><label>Prix de départ  :</label><br />
            <input type="text" name="price" value="<?php echo $price; ?>" /></p>
	    <p><label>Détails et conditions :</label><br />
		    <textarea cols="50" rows="5" name="details"><?php echo $details; ?></textarea></p>
        <?php
    }

    function cabins()
    {
        global $post;
        $custom = get_post_custom($post->ID);
        $cabin1 = $custom["cabin1"][0];
        $cabin2 = $custom["cabin2"][0];
        $cabin3 = $custom["cabin3"][0];
        $cabin4 = $custom["cabin4"][0];
        $cabin5 = $custom["cabin5"][0];
        ?>
        <p><label>Cabine intérieure :</label><br />
            <input type="text" name="cabin1" value="<?php echo $cabin1; ?>" /></p>
        <p><label>Cabine vue sur mer :</label><br />
            <input type="text" name="cabin2" value="<?php echo $cabin2; ?>" /></p>
        <p><label>Cabine avec balcon :</label><br />
            <input type="text" name="cabin3" value="<?php echo $cabin3; ?>" /></p>
        <p><label>Cabine avec mini-suite :</label><br />
            <input type="text" name="cabin4" value="<?php echo $cabin4; ?>" /></p>
        <p><label>Cabine avec suite :</label><br />
            <input type="text" name="cabin5" value="<?php echo $cabin5; ?>" /></p>
    <?php
    }

    function save_details()
    {
        global $post;

        update_post_meta($post->ID, "slogan", $_POST["slogan"]);
        update_post_meta($post->ID, "theme", $_POST["theme"]);
        update_post_meta($post->ID, "ship", $_POST["ship"]);
        update_post_meta($post->ID, "travel", $_POST["travel"]);
        update_post_meta($post->ID, "departure", $_POST["departure"]);
        update_post_meta($post->ID, "duration", $_POST["duration"]);
        update_post_meta($post->ID, "price", $_POST["price"]);
	    update_post_meta($post->ID, "details", $_POST["details"]);
        update_post_meta($post->ID, "cabin1", $_POST["cabin1"]);
        update_post_meta($post->ID, "cabin2", $_POST["cabin2"]);
        update_post_meta($post->ID, "cabin3", $_POST["cabin3"]);
        update_post_meta($post->ID, "cabin4", $_POST["cabin4"]);
        update_post_meta($post->ID, "cabin5", $_POST["cabin5"]);
    }

    add_action('save_post', 'save_details');

}
Viewing all 8245 articles
Browse latest View live




Latest Images